-
Notifications
You must be signed in to change notification settings - Fork 16
Closed
Milestone
Description
Hello!
First of all, thanks for the great library!
Maybe this is intentional, but I just spent way too much time figuring out why any 3 of the whitespace ignore rules were not working and were in fact returning twice the differences than w/o any additional rules.
Turns out, if you create XmlDocument with PreserveWhitespace set to true and use that as input source, then the whitespace rules don't work.
I've modified one of the test cases:
[Test]
public void TestDiff_withIgnoreWhitespaces_shouldSucceed() {
// prepare testData
string controlXml = "<a><b>Test Value</b></a>";
string testXml = "<a>\n <b>\n Test Value\n </b>\n</a>";
var controlDoc = new XmlDocument
{
PreserveWhitespace = true
};
controlDoc.LoadXml(controlXml);
var testDoc = new XmlDocument
{
PreserveWhitespace = true
};
testDoc.LoadXml(testXml);
// run test
var myDiff = DiffBuilder.Compare(Input.FromDocument(controlDoc).Build())
.WithTest(Input.FromDocument(testDoc).Build())
.IgnoreWhitespace()
.Build();
// validate result
Assert.IsFalse(myDiff.HasDifferences(), "XML similar " + myDiff.ToString());
}I guess I would have expected that any of the whitespace ignore rules would take precedence over PreserveWhitespace setting.
Metadata
Metadata
Assignees
Labels
No labels