Пример #1
0
        static void Main(string[] args)
        {
            var source  = FileService.ReadFile(args[0]);
            var changeA = FileService.ReadFile(args[1]);
            var changeB = FileService.ReadFile(args[2]);
            var result  = MergeService.ThreeWayMerge(source, changeA, changeB);

            FileService.WriteFile(result);
        }
Пример #2
0
        public void ThreeWayMerge_NoChange_ResultEqualsToSource()
        {
            var source  = FileService.ReadFile("TestFiles/NoChanges/source.txt");
            var changeA = FileService.ReadFile("TestFiles/NoChanges/changeA.txt");
            var changeB = FileService.ReadFile("TestFiles/NoChanges/changeB.txt");

            var result = MergeService.ThreeWayMerge(source, changeA, changeB);

            Assert.AreEqual(source, result);
        }
Пример #3
0
        public void ThreeWayMerge_MultipleChanges_ResultAllChanges()
        {
            var source         = FileService.ReadFile("TestFiles/Multiple/source.txt");
            var changeA        = FileService.ReadFile("TestFiles/Multiple/changeA.txt");
            var changeB        = FileService.ReadFile("TestFiles/Multiple/changeB.txt");
            var expectedResult = FileService.ReadFile("TestFiles/Multiple/result.txt");

            var result = MergeService.ThreeWayMerge(source, changeA, changeB);

            Assert.AreEqual(expectedResult, result);
        }
Пример #4
0
        public void ThreeWayMerge_AddedInBoth_ResultHaveBothChanges()
        {
            var source         = FileService.ReadFile("TestFiles/Added/source.txt");
            var changeA        = FileService.ReadFile("TestFiles/Added/changeA.txt");
            var changeB        = FileService.ReadFile("TestFiles/Added/changeB.txt");
            var expectedResult = FileService.ReadFile("TestFiles/Added/result.txt");

            var result = MergeService.ThreeWayMerge(source, changeA, changeB);

            Assert.AreEqual(expectedResult, result);
        }
Пример #5
0
        public void ThreeWayMerge_MergeConflict_ResultHaveConflictNotice()
        {
            var source         = FileService.ReadFile("TestFiles/MergeConflict/source.txt");
            var changeA        = FileService.ReadFile("TestFiles/MergeConflict/changeA.txt");
            var changeB        = FileService.ReadFile("TestFiles/MergeConflict/changeB.txt");
            var expectedResult = FileService.ReadFile("TestFiles/MergeConflict/result.txt");

            var result = MergeService.ThreeWayMerge(source, changeA, changeB);

            Assert.AreEqual(expectedResult, result);
        }