404 [Fact]
405 public void AssertStringEqualAndIdenticalToSelf()
406 { 407 string control = "<assert>true</assert>";
408 string test = "<assert>true</assert>";
409 XmlAssertion.AssertXmlIdentical(control, test);
410 XmlAssertion.AssertXmlEquals(control, test);
411 }
412
413 private static readonly string MY_SOLAR_SYSTEM =
414 "<solar-system><planet name='Earth' position='3' supportsLife='yes'/><planet name='Venus' position='4'/></solar-system>";
415
416 [Fact]
417 public void AssertXPathExistsWorksForExistentXPath()
418 { 419 XmlAssertion.AssertXPathExists("//planet[@name='Earth']", 420 MY_SOLAR_SYSTEM);
421 }
422
423 [Fact]
424 public void AssertXPathEvaluatesToWorksForMatchingExpression()
425 { 426 XmlAssertion.AssertXPathEvaluatesTo("//planet[@position='3']/@supportsLife", 427 MY_SOLAR_SYSTEM,
428 "yes");
429 }
430
431 [Fact]
432 public void AssertXslTransformResultsWorksWithStrings()
433 { 434 string xslt = XsltTests.IDENTITY_TRANSFORM;
435 string someXml = "<a><b>c</b><b/></a>";
436 XmlAssertion.AssertXslTransformResults(xslt, someXml, someXml);
437 }
438
404 [Fact]
405 public void AssertStringEqualAndIdenticalToSelf()
406 { 407 string control = "<assert>true</assert>";
408 string test = "<assert>true</assert>";
409 test.ShouldBeXmlIdenticalTo(control);
410 test.ShouldBeXmlEqualTo(control);
411 }
412
413 private static readonly string MY_SOLAR_SYSTEM =
414 "<solar-system><planet name='Earth' position='3' supportsLife='yes'/><planet name='Venus' position='4'/></solar-system>";
415
416 [Fact]
417 public void AssertXPathExestsWorksForXmlInput()
418 { 419 new XmlInput(MY_SOLAR_SYSTEM)
420 .XPath("//planet[@name='Earth']") 421 .ShouldExist();
422 }
423
424 [Fact]
425 public void AssertXPathEvaluatesToWorksForMatchingExpression()
426 { 427 MY_SOLAR_SYSTEM
428 .XPath("//planet[@position='3']/@supportsLife") 429 .ShouldEvaluateTo("yes"); 430 }
431
432 [Fact]
433 public void AssertXPathExistsWorksWithXpathFirstWithXmlInput()
434 { 435 var sut = new XmlInput(MY_SOLAR_SYSTEM);
436
437 "//planet[@name='Earth']".AppliedTo(sut).ShouldExist();
438 }
439
440 [Fact]
441 public void AssertXPathEvaluatesToWorksWithXPathFirst()
442 { 443 "//planet[@position='3']/@supportsLife"
444 .AppliedTo(MY_SOLAR_SYSTEM)
445 .ShouldEvaluateTo("yes"); 446 }
447
448 [Fact]
449 public void AssertXslTransformResultsWorksWithStrings()
450 { 451 string xslt = XsltTests.IDENTITY_TRANSFORM;
452 string someXml = "<a><b>c</b><b/></a>";
453
454 someXml.XsltTransformation(xslt).ShouldResultIn(someXml);
455 }