public void WriterIsReusable() { // Arrange var writer = new SimplifiedXPathWriter(); var element = new XElement("a"); writer.Write(element); // Act var result = writer.Write(element); // Assert Assert.That(result, Is.EqualTo("/a")); }
public void WriteOutputIsValid(string xml, string validXPath, string simplifiedXPath) { // Arrange var includeAllAttributesExceptNamespaceDeclarations = Substitute.For<IAttributeFilter>(); includeAllAttributesExceptNamespaceDeclarations.IsIncluded(Arg.Any<XAttribute>()).Returns(info => !info.Arg<XAttribute>().IsNamespaceDeclaration); var filters = new[] {includeAllAttributesExceptNamespaceDeclarations}; var testNode = xml.SelectSingleNode(validXPath); // Act var actualXPath = new SimplifiedXPathWriter(filters).Write(testNode); // Assert Assert.That(actualXPath, Is.EqualTo(simplifiedXPath)); }