Beispiel #1
0
        public void AddAddConflictTakeOtherTest()
        {
            // initial migration
            MigrationItemStrings file1 = new MigrationItemStrings("1.txt", "1.txt", TestEnvironment, true);

            SourceAdapter.AddFile(file1.LocalPath);
            RunAndValidate();

            // add a same file on both ends
            string fileName = "a.txt";
            MigrationItemStrings sourceFile = new MigrationItemStrings(fileName, fileName, TestEnvironment, true);
            MigrationItemStrings targetFile = new MigrationItemStrings(fileName, fileName, TestEnvironment, false);

            SourceAdapter.AddFile(sourceFile.LocalPath);
            TargetAdapter.AddFile(targetFile.LocalPath);

            Run();
            VerifyHistory(2, 1);

            // resolve conflicts
            ConflictResolver  conflictResolver = new ConflictResolver(Configuration);
            List <RTConflict> conflicts        = conflictResolver.GetConflicts();

            Assert.AreEqual(1, conflicts.Count, "There should be 1 conflict");
            VCContentConflictType contentConflict = new VCContentConflictType();

            Assert.IsTrue(contentConflict.ReferenceName.Equals(conflicts[0].ConflictTypeReference.Value.ReferenceName), "It should be vc content conflict");

            // resolve the vc content conflict. The chained conflict will be resolved automatically
            conflictResolver.TryResolveConflict(conflicts[0], new VCContentConflictTakeOtherChangesAction(), "$/");

            // The user decide to accept other, so he deleted the items on target system
            TargetAdapter.DeleteItem(targetFile.ServerPath, "Delete source items to accept other side's adds **NOMIGRATION**");

            Run(true, true);
            Assert.IsTrue(VerifyContents());
        }