fitSharp
Xml Fixture
XmlFixture compares an XML document to the expected values in the table.

There is one row for each element. The first non-empty cell is the element name. The next cell is the concatentation of all child text nodes of the element, if any. The remaining cells are attribute name and value pairs for all attributes of the element, if any. If no text, the attribute cells follow immediately after the element name. The element tree structure is indicated by leading empty cells.

when test is
story test fixture
checktest result
xml fixture under test
root
child1some text
child2text1text2item1value1item2value2
leafnamevalue
child3

xml fixture under test
root
child1some text
child2text1text2item1value1item2value2
leafnamevalue
child3

xml fixture under test
root
child1some text
child2text1text2item1value1item2value2
leafnamevalue
child3
then result is
xml fixture under test
root
child1some text
child2text1text2item1value1item2value2
leafnamevalue
child3

Missing and surplus elements are reported.

when test is
story test fixture
checktest result
xml fixture under test
root
child1some text
child1a
child2text1text2item1value1item2value2
leafnamevalue

xml fixture under test
root
child1some text
missingchild1a
child2text1text2item1value1item2value2
leafnamevalue
surplus child3

xml fixture under test
root
child1some text
child1a
child2text1text2item1value1item2value2
leafnamevalue
then result is
xml fixture under test
root
child1some text
missingchild1a
child2text1text2item1value1item2value2
leafnamevalue
surplus child3

Out of order elements are reported.

when test is
story test fixture
checktest result
xml fixture under test
root
child1some text
child2text1text2item1value1item2value2
child3
leafnamevalue

xml fixture under test
root
child1some text
child2text1text2item1value1item2value2
out of orderchild3
out of orderleafnamevalue

xml fixture under test
root
child1some text
child2text1text2item1value1item2value2
child3
leafnamevalue
then result is
xml fixture under test
root
child1some text
child2text1text2item1value1item2value2
out of orderchild3
out of orderleafnamevalue
Copyright © 2022 Syterra Software Inc. All rights reserved.