I have a sample Xml code snippet
<modification name="givenName" operation="add" xmlns="urn:oasis:names:tc:DSML:2:0:core">
<value>Changed name</value>
</modification>
The xml is loaded to my XElement, and I used
XElement xml = ...to load xml above...;
xml.Should().HaveAttribute("name", "givenName")
.And.HaveAttribute("operation", "add")
.And.HaveAttribute("xmlns", "urn:oasis:names:tc:DSML:2:0:core")
.And.HaveElement("value");
to test my code, the attributes testing are all passed, but the element testing (the last condition) fails.
Anyone can point out what is wrong with my code?
And how can I test the Xml has an element named "value" and its value is "Changed name"?
Thanks in advance!