Esempio n. 1
0
        public void InvalidFieldValueConflictBypassRuleEnabledTest()
        {
            // test invalid field value conflict bypass rule
            TestEnvironment.CustomActions += new MigrationTestEnvironment.Customize(ConfigCustomizer.CustomActions_DisableCSSNodeCreationOnTarget);
            TestEnvironment.CustomActions += new MigrationTestEnvironment.Customize(ConfigCustomizer.CustomActions_EnableBypassRulesOnTarget);

            // add a work item on source side
            int id = TfsSourceAdapter.AddWorkItem("Bug", "title", "description", @"source2\Test Path");

            // sync
            RunAndNoValidate();

            //// verify there's no conflicts raised
            ConflictResolver  conflictResolver = new ConflictResolver(Configuration);
            List <RTConflict> conflicts        = conflictResolver.GetConflicts();

            //Assert.AreEqual(0, conflicts.Count, "There should be no conflicts");

            // verify we have edit/edit conflict
            //conflicts = conflictResolver.GetConflicts();
            Assert.IsTrue(conflicts.Count >= 1, "There should be invalid field value conflict");
            Assert.IsTrue(ConflictConstant.InvalidFieldValueConflictType.Equals(conflicts[0].ConflictTypeReference.Value.ReferenceName), "It should be invalid field value conflict");

            //// resolve the conflict and resume
            //conflictResolver.TryResolveConflict(conflicts[0], new WITEditEditConflictTakeSourceChangesAction(), "/" + id);

            //// restart the migration tool
            //RunAndNoValidate(true);

            //// verify sync result
            //VerifySyncResult(true);
        }
Esempio n. 2
0
        public void Link_DeleteRelatedLinkFromTargetTest()
        {
            TestEnvironment.CustomActions += new MigrationTestEnvironment.Customize(ConfigCustomizer.CustomActions_DisableContextSync);

            // add a work item on source side
            int sourceId1 = TfsSourceAdapter.AddWorkItem("Bug", "title1", "description1");

            int sourceId2 = TfsSourceAdapter.AddWorkItem("Bug", "title2", "description2");

            RunAndNoValidate();

            int targetId1 = QueryTargetWorkItemID(sourceId1);

            Console.WriteLine(String.Format("SourceId1: {0}, TargetId1: {1}", sourceId1, targetId1));
            int targetId2 = QueryTargetWorkItemID(sourceId2);

            Console.WriteLine(String.Format("SourceId2: {0}, TargetId2: {1}", sourceId2, targetId2));

            // source: add a related link
            TfsSourceAdapter.AddRelatedWorkItemLink(sourceId1, sourceId2);
            RunAndNoValidate(true);

            // source side should have one link
            int sourceLinkCount = TfsSourceAdapter.GetRelatedLinkCount(sourceId1);

            Assert.AreEqual(1, sourceLinkCount, "RelatedLink count on source system should be 1");

            int targetLinkCount = TfsTargetAdapter.GetRelatedLinkCount(targetId1);

            Assert.AreEqual(1, targetLinkCount, "RelatedLink count on target system should be 1");

            // target: delete the mirrored link
            TfsTargetAdapter.DeleteRelatedWorkItemLink(targetId1, targetId2);
            RunAndNoValidate(true);

            // now target side shouldn't have any links
            targetLinkCount = TfsTargetAdapter.GetRelatedLinkCount(targetId1);
            Assert.AreEqual(0, targetLinkCount, "RelatedLink count on target system should be 0");

            // verify there's no conflicts raised
            ConflictResolver  conflictResolver = new ConflictResolver(Configuration);
            List <RTConflict> conflicts        = conflictResolver.GetConflicts();

            Assert.AreEqual(0, conflicts.Count, "There should be no conflicts");

            sourceLinkCount = TfsSourceAdapter.GetRelatedLinkCount(sourceId1);

            if (TestEnvironment.MigrationTestType == MigrationTestType.OneWay)
            {
                // source side should still have the original link
                Assert.AreEqual(1, sourceLinkCount, "source side link should still exist");
            }
            else
            {
                // now source side shouldn't have any links
                Assert.AreEqual(0, sourceLinkCount, "source side link should be deleted");

                // verify sync result
                WitDiffResult result = GetDiffResult();

                // ignore Area/Iteration path mismatches
                VerifySyncResult(result, new List <string> {
                    FIELD_ITERATION_PATH, FIELD_AREA_PATH
                });
            }
        }