Exemplo n.º 1
0
        public void NodesAddedInBetweenOtherNodes1()
        {
            string before = @"class C{ 
void Foo(){
Icon i = new Icon(icon);
box.Image = i.ToBitmap();
Controls.Add(box);
}
}";

            string after = @"
class C{ 
void Foo(){
Icon i = new Icon(icon);
box.Location = new System.Drawing.Point();
box.TabStop = false;
box.Image = i.ToBitmap();
Controls.Add(box);
}
}";

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

            Assert.AreEqual(2, codeDiff.GetAdded().Count());
            Assert.AreEqual(0, codeDiff.GetRemoved().Count());
            Assert.AreEqual(0, codeDiff.GetModified().Count());
        }
Exemplo n.º 2
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());
        }
Exemplo n.º 3
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());
        }
Exemplo n.º 4
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());
        }