コード例 #1
0
        public void TokenAdded1()
        {
            string before   = @"class C{}";
            string after    = @"public class C{}";
            var    codeDiff = CompilationHelpers.GetDiff(before, after);

            Assert.AreEqual(1, codeDiff.GetAdded().Count());
            Assert.AreEqual("public", codeDiff.GetAdded().First().After.ToString());
            Assert.AreEqual(0, codeDiff.GetRemoved().Count());
            Assert.AreEqual(0, codeDiff.GetModified().Count());
        }
コード例 #2
0
        public void Identical2()
        {
            string after  = @"";
            string before = @"";

            var codeDiff = CompilationHelpers.GetDiff(before, after);

            Assert.AreEqual(0, codeDiff.GetAdded().Count());
            Assert.AreEqual(0, codeDiff.GetRemoved().Count());
            Assert.AreEqual(0, codeDiff.GetModified().Count());
        }
コード例 #3
0
        public void NodeDeletedEnd1()
        {
            string after  = @"class C{}";
            string before = @"class C{} class D{}";

            var codeDiff = CompilationHelpers.GetDiff(before, after);

            Assert.AreEqual(0, codeDiff.GetAdded().Count());
            Assert.AreEqual(1, codeDiff.GetRemoved().Count());
            Assert.AreEqual("class D{}", codeDiff.GetRemoved().First().Before.ToString());
            Assert.AreEqual(0, codeDiff.GetModified().Count());
        }