Example #1
0
        public void TestSplitDiffParsing()
        {
            string inputA =
                "This is a test file!\n" +
                "Added another line to test file\n" +
                "Adding a third line to test file";

            string inputB =
                "This is a test file!\n" +
                "Added another line to test file\n" +
                "Adding a third line to test file\n" +
                "Adding a fourth line to test file";

            List <Diff.Diff> diff      = DiffFactory.GenerateDiffCache(inputA, inputB);
            SplitDiffModel   splitDiff = DiffFactory.GenerateSplitDiff(diff);

            Assert.IsTrue(splitDiff.SideA.LineCount == 3);
            Assert.IsTrue(splitDiff.SideB.LineCount == 4);

            DiffTextLine addedLine = splitDiff.SideB.GetLine(3) as DiffTextLine;

            Assert.IsTrue(addedLine.BeforeLineNo == -1);
            Assert.IsTrue(addedLine.LineNo == 4);
            Assert.IsTrue(addedLine.ChangeType == DiffLineType.Insert);
        }