Ejemplo n.º 1
0
        public void When_AddNodeattr_Method_call_should_not_return_null()//
        {
            AddNewAttributeAndAddedNewNodeInformationInResult addNewAttributeAndAddedNewNodeInformationInResult = new AddNewAttributeAndAddedNewNodeInformationInResult();
            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 Moved=\"true\" Deleted=\"true\" movedpos=\"1\"><!--Any comments?--><z id=\"10\">Just another text</z></y></b>");

            Assert.AreNotEqual(null, addNewAttributeAndAddedNewNodeInformationInResult.AddNodeattr(diffXDoc, resultXDoc).ToString());
        }
Ejemplo n.º 2
0
        public void When_ProcessNode_Method_call_it_should_not_return_null()
        {
            AddNewAttributeAndAddedNewNodeInformationInResult addNewAttributeAndAddedNewNodeInformationInResult = new AddNewAttributeAndAddedNewNodeInformationInResult();
            XElement  xElement   = XElement.Parse("<xd:add type=\"1\" name=\"p\" cs_parent=\"1/5\" xmlns:xd=\"http://schemas.microsoft.com/xmltools/2002/xmldiff\"><xd:add type=\"1\" name=\"q\"><xd:add match=\"/1/6\" opid=\"1\" /></xd:add></xd:add>");
            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><Addition><e>Some text 4</e><f>Some text 5</f></Addition><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\" Addattrname_newAttr=\"new value\" /><y Moved=\"true\" Deleted=\"true\" movedpos=\"1\"><!--Any comments?--><z id=\"10\">Just another text</z></y></b>");

            Assert.AreNotEqual(null, addNewAttributeAndAddedNewNodeInformationInResult.ProcessNode(xElement, diffXDoc, resultXDoc).ToString());
        }
Ejemplo n.º 3
0
        public void When_AddSingleNode_Method_call_it_should_not_return_null()
        {
            AddNewAttributeAndAddedNewNodeInformationInResult addNewAttributeAndAddedNewNodeInformationInResult = new AddNewAttributeAndAddedNewNodeInformationInResult();
            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\" Addattrname_newAttr=\"new value\" /><y Moved=\"true\" Deleted=\"true\" movedpos=\"1\"><!--Any comments?--><z id=\"10\">Just another text</z></y></b>");

            Assert.AreNotEqual(null, addNewAttributeAndAddedNewNodeInformationInResult.AddSingleNode(diffXDoc, resultXDoc).ToString());
        }
Ejemplo n.º 4
0
        public void When_AddSingleNode_Method_call_it_should_add_information_of_added_node()
        {
            AddNewAttributeAndAddedNewNodeInformationInResult addNewAttributeAndAddedNewNodeInformationInResult = new AddNewAttributeAndAddedNewNodeInformationInResult();
            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><Addition><e>Some text 4</e><f>Some text 5</f></Addition><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\" Addattrname_newAttr=\"new value\" /><Addition><p><q><y Moved=\"true\" Deleted=\"true\" movedpos=\"1\"><!--Any comments?--><z id=\"10\">Just another text</z></y></q></p></Addition><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\" Addattrname_newAttr=\"new value\" /><y Moved=\"true\" Deleted=\"true\" movedpos=\"1\"><!--Any comments?--><z id=\"10\">Just another text</z></y></b>");

            Assert.AreEqual(expectedResult.ToString(), addNewAttributeAndAddedNewNodeInformationInResult.AddSingleNode(diffXDoc, resultXDoc).ToString());
        }