Skip to content

Commit 0952ce9

Browse files
committed
testcase for #34
1 parent de08f4d commit 0952ce9

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

src/tests/net-core/Builder/DiffBuilderTest.cs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -486,6 +486,24 @@ public void TestDiff_withIgnoreElementContentWhitespaces_shouldSucceed() {
486486
Assert.IsFalse(myDiff.HasDifferences(), "XML similar " + myDiff.ToString());
487487
}
488488

489+
[Test]
490+
public void CanIgnoreSequenceOfChildNodes() {
491+
var xml1 = "<A><B>1</B><C>2</C></A>";
492+
var xml2 = "<A><C>2</C><B>1</B></A>";
493+
494+
var source1 = Input.FromString(xml1).Build();
495+
var source2 = Input.FromString(xml2).Build();
496+
497+
var diff = DiffBuilder
498+
.Compare(source1)
499+
.WithTest(source2)
500+
.WithDifferenceEvaluator(DifferenceEvaluators.DowngradeDifferencesToEqual(ComparisonType.CHILD_NODELIST_SEQUENCE))
501+
.WithNodeMatcher(new DefaultNodeMatcher(ElementSelectors.ByName))
502+
.CheckForSimilar()
503+
.Build();
504+
Assert.IsFalse(diff.HasDifferences(), "XML equal " + diff);
505+
}
506+
489507
internal class DummyComparisonFormatter : IComparisonFormatter {
490508
public string GetDescription(Comparison difference) {
491509
return "foo";

0 commit comments

Comments
 (0)