Beispiel #1
0
        public void Link_DeleteRelatedLinkFromBothSideTest()
        {
            TestEnvironment.CustomActions += new MigrationTestEnvironment.Customize(ConfigCustomizer.CustomActions_DisableContextSync);
            TestEnvironment.CustomActions += new MigrationTestEnvironment.Customize(ConfigCustomizer.CustomActions_SetBidirectionalNoContextSync);

            // add a work item on source side
            string title1      = string.Format("{0} {1}", TestContext.TestName, DateTime.Now.ToString("HH'_'mm'_'ss"));
            int    workitemId1 = SourceAdapter.AddWorkItem("Bug", title1, "description1");

            string title2      = string.Format("{0} {1}", TestContext.TestName, DateTime.Now.ToString("HH'_'mm'_'ss"));
            int    workitemId2 = SourceAdapter.AddWorkItem("Bug", title1, "description2");

            TestEnvironment.CustomActions += new MigrationTestEnvironment.Customize(SetTargetFilterString);

            RunAndNoValidate();

            int mirroredId1 = QueryMirroredWorkItemID(workitemId1);
            int mirroredId2 = QueryMirroredWorkItemID(workitemId2);

            // source: add a related link
            TfsSourceAdapter.AddRelatedWorkItemLink(workitemId1, workitemId2);
            RunAndNoValidate(true);
            Assert.AreEqual(1, TfsTargetAdapter.GetRelatedLinkCount(mirroredId1), "RelatedLink count on target system is wrong");

            // source: delete the link
            TfsSourceAdapter.DeleteRelatedWorkItemLink(workitemId1, workitemId2);

            // target: delete the same link
            TfsTargetAdapter.DeleteRelatedWorkItemLink(mirroredId1, mirroredId2);
            RunAndNoValidate(true);

            // now both sides shouldn't have a link
            Assert.AreEqual(0, TfsSourceAdapter.GetRelatedLinkCount(workitemId1), "RelatedLink count on source system is wrong");
            Assert.AreEqual(0, TfsTargetAdapter.GetRelatedLinkCount(workitemId1), "RelatedLink count on target system is wrong");


            // 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 sync result
            WitDiffResult result = GetDiffResult();

            // ignore Area/Iteration path mismatches
            VerifySyncResult(result, new List <string> {
                FIELD_ITERATION_PATH, FIELD_AREA_PATH
            });
        }
Beispiel #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
                });
            }
        }