Skip to content

Commit 854299a

Browse files
committed
Updated unit test to account for IsNew validation in Save()
With the introduction of `IsNew` validation in `Save()` (4da0d43), one of the unit tests failed due to an attempt to save a topic whose parent wasn't saved. This is easily fixed by assigning `Id`s to these topics, which is what we'd expect in a real-world scenario. While I was at it, I updated the `Assert` statement to look for an exact match, which is more precise.
1 parent 4da0d43 commit 854299a

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

OnTopic.Tests/TopicRepositoryBaseTest.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -910,9 +910,9 @@ public void Move_ContentTypeDescriptor_UpdatesContentTypeCache() {
910910
[Fact]
911911
public void Save_AttributeDescriptor_UpdatesContentType() {
912912

913-
var contentType = new ContentTypeDescriptor("Parent", "ContentTypeDescriptor");
914-
var attributeList = new Topic("Attributes", "List", contentType);
915-
var childContentType = new ContentTypeDescriptor("Child", "ContentTypeDescriptor", contentType);
913+
var contentType = new ContentTypeDescriptor("Parent", "ContentTypeDescriptor", null, 1);
914+
var attributeList = new Topic("Attributes", "List", contentType, 2);
915+
var childContentType = new ContentTypeDescriptor("Child", "ContentTypeDescriptor", contentType, 3);
916916

917917
Contract.Assume(childContentType);
918918

@@ -924,7 +924,7 @@ public void Save_AttributeDescriptor_UpdatesContentType() {
924924

925925
_topicRepository.Save(newAttribute);
926926

927-
Assert.True(childContentType.AttributeDescriptors.Count > attributeCount);
927+
Assert.Equal<int>(attributeCount+1, childContentType.AttributeDescriptors.Count);
928928

929929
}
930930

0 commit comments

Comments
 (0)