示例#1
0
        public void When_MovedNodeAtr_Method_call_not_return_null()
        {
            AddMovedAttributeNodeInformationInResult addMovedAttributeNodeInformationInResult = new AddMovedAttributeNodeInformationInResult();
            XDocument diffXDoc   = XDocument.Parse("<xd:xmldiff version=\"1.0\" srcDocHash=\"1760821081405616385\" options=\"None\" fragments=\"no\" xmlns:xd=\"http://schemas.microsoft.com/xmltools/2002/xmldiff\"><xd:node match=\"1\" cs_base=\"true\"><xd:change match=\"1\" name=\"yy\" cs_parent=\"1\" /><xd:node match=\"3\" /><xd:add cs_parent=\"1/3\"><e>Some text 4</e><f>Some text 5</f></xd:add><xd:node match=\"4\"><xd:change match=\"1\" cs_parent=\"1/4\">Changed text</xd:change><xd:remove match=\"2\" cs_parent=\"1/4\" /></xd:node><xd:node match=\"5\"><xd:remove match=\"@secondAttr\" cs_parent=\"1/5\" /><xd:add type=\"2\" name=\"newAttr\" cs_parent=\"1/5\">new value</xd:add><xd:change match=\"@firstAttr\" cs_parent=\"1/5\">changed attribute value</xd:change></xd:node><xd:remove match=\"6\" opid=\"1\" cs_parent=\"1\" /><xd:add type=\"1\" name=\"p\" cs_parent=\"1/5\"><xd:add type=\"1\" name=\"q\"><xd:add match=\"/1/6\" opid=\"1\" /></xd:add></xd:add></xd:node><xd:descriptor opid=\"1\" type=\"move\" /></xd:xmldiff>");
            XDocument resultXDoc = XDocument.Parse("<b cs_crestid=\"1\"><a OldName=\"a\" NewName=\"yy\">Some text 1</a><b>Some text 2</b><c cs_crestid=\"3\">Some text 3</c><d cs_crestid=\"4\"><textchanged><del>Another text</del><ins>Changed text</ins></textchanged><fob Deleted=\"true\" /></d><x firstAttr=\"changed attribute value\" cs_crestid=\"5\" oldattr_firstAttr=\"value1\" removeattr_secondAttr=\"value2\" /><y><!--Any comments?--><z id=\"10\">Just another text</z></y></b>");

            Assert.AreNotEqual(null, addMovedAttributeNodeInformationInResult.MovedNodeAtr(diffXDoc, resultXDoc).ToString());
        }
示例#2
0
        public void When_MovedNodeAtr_Method_call_it_should_add_information_of_moved_attribute_node_information()
        {
            AddMovedAttributeNodeInformationInResult addMovedAttributeNodeInformationInResult = new AddMovedAttributeNodeInformationInResult();
            XDocument expectedResult = XDocument.Parse("<b cs_crestid=\"1\"><a OldName=\"a\" NewName=\"yy\">Some text 1</a><b>Some text 2</b><c cs_crestid=\"3\">Some text 3</c><d cs_crestid=\"4\"><textchanged><del>Another text</del><ins>Changed text</ins></textchanged><fob Deleted=\"true\" /></d><x firstAttr=\"changed attribute value\" cs_crestid=\"5\" oldattr_firstAttr=\"value1\" removeattr_secondAttr=\"value2\" /><y Moved=\"true\" Deleted=\"true\" movedpos=\"1\"><!--Any comments?--><z id=\"10\">Just another text</z></y></b>");
            XDocument resultXDoc     = XDocument.Parse("<b cs_crestid=\"1\"><a OldName=\"a\" NewName=\"yy\">Some text 1</a><b>Some text 2</b><c cs_crestid=\"3\">Some text 3</c><d cs_crestid=\"4\"><textchanged><del>Another text</del><ins>Changed text</ins></textchanged><fob Deleted=\"true\" /></d><x firstAttr=\"changed attribute value\" cs_crestid=\"5\" oldattr_firstAttr=\"value1\" removeattr_secondAttr=\"value2\" /><y><!--Any comments?--><z id=\"10\">Just another text</z></y></b>");

            Assert.AreEqual(expectedResult.ToString(), addMovedAttributeNodeInformationInResult.MovedNodeAtr(diffXDoc, resultXDoc).ToString());
        }