Esempio n. 1
0
        public void ExecuteComapare()
        {
            FileComparer fileComparer = new FileComparer();

            ServerUser1Modifications = fileComparer.Compare(ServerFile, User1File);
            ServerUser2Modifications = fileComparer.Compare(ServerFile, User2File);
            MergedModifications = new ModificationCollection();

            RaiseStateChanged();
        }
Esempio n. 2
0
        public void ExecuteComapare()
        {
            FileComparer fileComparer = new FileComparer();

            ServerUser1Modifications = fileComparer.Compare(ServerFile, User1File);
            ServerUser2Modifications = fileComparer.Compare(ServerFile, User2File);
            MergedModifications      = new ModificationCollection();

            RaiseStateChanged();
        }
Esempio n. 3
0
        public void TestAdded()
        {
            TextFile file1 = new TextFile();
            file1.AddLine("1");
            file1.AddLine("3");

            TextFile file2 = new TextFile();
            file2.AddLine("1");
            file2.AddLine("2");
            file2.AddLine("3");

            FileComparer fileComparer = new FileComparer();
            ModificationCollection report = fileComparer.Compare(file1, file2);

            ModificationAreEqual(report[0], "NoChanged", 0, 0, 1);
            ModificationAreEqual(report[1], "Added", -1, 1, 1);
            ModificationAreEqual(report[2], "NoChanged", 1, 2, 1);
        }
Esempio n. 4
0
        public void TestEmptyFiles()
        {
            TextFile emptyFile = new TextFile();

            TextFile file2 = new TextFile();
            file2.AddLine("public class MyClass");
            file2.AddLine("{");
            file2.AddLine("}");

            FileComparer fileComparer = new FileComparer();

            ModificationCollection report = fileComparer.Compare(emptyFile, file2);
            ModificationAreEqual(report[0], "Added", -1, 0, 3);

            report = fileComparer.Compare(file2, emptyFile);
            ModificationAreEqual(report[0], "Removed", 0, -1, 3);

            report = fileComparer.Compare(emptyFile, emptyFile);
            Assert.AreEqual(report.Count, 0);
        }
Esempio n. 5
0
        public void TestReplaced2()
        {
            TextFile file1 = new TextFile();
            file1.AddLine("1");
            file1.AddLine("4");
            file1.AddLine("3");

            TextFile file2 = new TextFile();
            file2.AddLine("2");

            FileComparer fileComparer = new FileComparer();
            ModificationCollection report = fileComparer.Compare(file1, file2);

            ModificationAreEqual(report[0], "Replaced", 0, 0, 1);
            ModificationAreEqual(report[1], "Removed", 1, -1, 2);
        }
Esempio n. 6
0
        public void TestMethod1()
        {
            TextFile file1 = new TextFile();
            file1.AddLine("public class MyClass");
            file1.AddLine("{");
            file1.AddLine("    public MyClass()");
            file1.AddLine("    { }");
            file1.AddLine();
            file1.AddLine("    public string StringProperty");
            file1.AddLine("    {");
            file1.AddLine("        get;");
            file1.AddLine("        set;");
            file1.AddLine("    }");
            file1.AddLine("}");

            TextFile file2 = new TextFile();
            file2.AddLine("public class MyClass");
            file2.AddLine("{");
            file2.AddLine("    public MyClass()");
            file2.AddLine("    { }");
            file2.AddLine();
            file2.AddLine("    public int MyMethod(int value)");
            file2.AddLine("    {");
            file2.AddLine("        Console.WriteLine(value);");
            file2.AddLine("    }");
            file2.AddLine("}");

            FileComparer fileComparer = new FileComparer();
            ModificationCollection report = fileComparer.Compare(file1, file2);

            ModificationAreEqual(report[0], "NoChanged", 0, 0, 5);
            ModificationAreEqual(report[1], "Replaced", 5, 5, 1);
            ModificationAreEqual(report[2], "NoChanged", 6, 6, 1);
            ModificationAreEqual(report[3], "Replaced", 7, 7, 1);
            ModificationAreEqual(report[4], "Removed", 8, -1, 1);
            ModificationAreEqual(report[5], "NoChanged", 9, 8, 2);
        }