0

Let's say I have an XElement object, which represents Xml like

<modification name="givenName" operation="add" xmlns="urn:oasis:names:tc:DSML:2:0:core">
    <value>Changed name</value>
    <child id="abc">Some dummy value</child>
</modification>

How can I test The <value> element's value is "Changed name", and <child> element has attribute id "abc", and value "Some dummy value"?

hardywang
  • 4,864
  • 11
  • 65
  • 101

1 Answers1

1
element.Should().HaveElement("value").Which.Should().HaveValue("Changed name");
element.Should().HaveElement("child").Which.Should().HaveAttribute("id", "abc").And.HaveValue("Some dummy value");
Cleb
  • 25,102
  • 20
  • 116
  • 151
Dennis Doomen
  • 8,368
  • 1
  • 32
  • 44