Quantcast
Channel: Fluent Assertions
Viewing all articles
Browse latest Browse all 1402

Created Issue: HaveElement doesn't seem to work [12446]

$
0
0
I have a class the produces the following XML...

<Operation Name="Test" Duration="0" />

If I parse the above XML into an XDocument and try to assert like so...

var testDoc = XDocument.Parse(result);
testDoc.Should().HaveElement("Operation");

I get the following error...

Expected XML document <Operation Name=\"Test\" Duration=\"1\" /> to have root element with child <Operation>, but no such child element was found.

If I try parsing it as an XElement like so...

var testElement = XElement.Parse(result);
testElement.Should().HaveElement("Operation");

I get the same error of...

Expected XML element <Operation Name=\"Test\" Duration=\"0\" /> to have child element <Operation>, but no such child element was found.

Viewing all articles
Browse latest Browse all 1402

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>