Skip to content

Commit

Permalink
improve tests
Browse files Browse the repository at this point in the history
  • Loading branch information
pwelter34 committed Feb 19, 2025
1 parent 3d3185b commit 3516986
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 2 deletions.
10 changes: 8 additions & 2 deletions test/EntityChange.Tests/EntityCompareTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1065,7 +1065,7 @@ public async Task CompareNestedObjectsPathsTest()
}

[Fact]
public void CompareValueTypeRootElementsTest()
public async Task CompareValueTypeRootElementsTest()
{
int original = 1;
int current = 2;
Expand All @@ -1078,10 +1078,12 @@ public void CompareValueTypeRootElementsTest()
ChangeRecord changeRecord = changes.First();
changeRecord.OriginalValue.Should().Be(1);
changeRecord.CurrentValue.Should().Be(2);

await Verifier.Verify(changes).UseDirectory("Snapshots");
}

[Fact]
public void CompareArrayRootElementsTest()
public async Task CompareArrayRootElementsTest()
{
TreeNode[] original = [new TreeNode { Name = "Level 1" }];
TreeNode[] current = [];
Expand All @@ -1093,6 +1095,8 @@ public void CompareArrayRootElementsTest()

ChangeRecord changeRecord = changes.First();
changeRecord.Path.Should().Be("[0]");

await Verifier.Verify(changes).UseDirectory("Snapshots");
}

[Fact]
Expand Down Expand Up @@ -1123,6 +1127,8 @@ public async Task CompareAbstract()
await Verifier.Verify(changes).UseDirectory("Snapshots");
}



private void WriteMarkdown(IReadOnlyList<ChangeRecord> changes)
{
var formatter = new MarkdownFormatter();
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[
{
PropertyName: [0],
DisplayName: 0,
Path: [0],
Operation: Remove,
OriginalValue: {
Name: Level 1
},
OriginalFormatted: EntityChange.Tests.Models.TreeNode
}
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[
{
PropertyName: ,
DisplayName: ,
Path: ,
Operation: Replace,
OriginalValue: 1,
CurrentValue: 2,
OriginalFormatted: 1,
CurrentFormatted: 2
}
]

0 comments on commit 3516986

Please sign in to comment.