예제 #1
0
        public void ProcessXml_RemoveXpath_RemovesXpathBasedOnText()
        {
            var preAlterationXmlString = $@"<?xml version='1.0' encoding='utf-8' ?><RootNode><SomeNode>Remove Me</SomeNode></RootNode>";
            var expectedXmlString      = $@"<?xml version='1.0' encoding='utf-8' ?><RootNode></RootNode>";
            var inputXml    = XmlDoc.LoadFromString(preAlterationXmlString);
            var expectedXml = XmlDoc.LoadFromString(expectedXmlString);

            var removeXPath = new RemoveXPathFromXml("//SomeNode[text()='Remove Me']");

            removeXPath.Alter(inputXml);

            inputXml.Should().BeEquivalentTo(expectedXml);
        }
예제 #2
0
        public void ProcessXml_RemoveXpath_RemovesXpath()
        {
            var preAlterationXmlString = $@"<?xml version='1.0' encoding='utf-8' ?><RootNode><IShouldBeRemoved></IShouldBeRemoved></RootNode>";
            var expectedXmlString      = $@"<?xml version='1.0' encoding='utf-8' ?><RootNode></RootNode>";
            var inputXml    = XmlDoc.LoadFromString(preAlterationXmlString);
            var expectedXml = XmlDoc.LoadFromString(expectedXmlString);

            var removeXPath = new RemoveXPathFromXml("//IShouldBeRemoved");

            removeXPath.Alter(inputXml);

            inputXml.Should().BeEquivalentTo(expectedXml);
        }