示例#1
0
        public void Linking_BasicLinkTest()
        {
            TestEnvironment.CustomActions += new MigrationTestEnvironment.Customize(TestEnvironment_AddCQWebUrlBase);
            TestEnvironment.CustomActions += new MigrationTestEnvironment.Customize(TestEnvironment_AddCQHyperLinkTypeMapping);

            // add a work item on source side
            int workitemId = SourceAdapter.AddWorkItem("Bug", "title", "description1");

            WITLinkChangeAction action1 = new WITLinkChangeAction(LinkChangeActionType.Add);

            action1.AddLink(new WITLink("link1"));
            SourceAdapter.UpdateWorkItemLink(workitemId, action1);

            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");

            string sourceHyperLinkUrl = string.Format(TestCQHyperLinkBaseUrl, workitemId.ToString());

            // verify migration result
            VerifySyncResult();
        }
示例#2
0
        public void Link_DeleteHyperLinkTest()
        {
            // TODO:  Figure out why this tests fail against TFS 2008 but works in TFS 2010

            TestEnvironment.CustomActions += new MigrationTestEnvironment.Customize(ConfigCustomizer.CustomActions_DisableContextSync);

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

            // add a link
            WITLinkChangeAction action1 = new WITLinkChangeAction(LinkChangeActionType.Add);
            WITLink             link1   = new WITLink("link1");

            action1.AddLink(link1);
            SourceAdapter.UpdateWorkItemLink(workitemId, action1);

            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");

            // delete the link
            action1 = new WITLinkChangeAction(LinkChangeActionType.Delete);
            action1.AddLink(link1);
            SourceAdapter.UpdateWorkItemLink(workitemId, action1);

            RunAndNoValidate(true);

            // verify there's no conflicts raised
            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
            });

            // TODO: Remove the following verification once ServerDiff supports link diffing.
            int mirroredId = QueryTargetWorkItemID(workitemId);

            Assert.AreEqual(TfsSourceAdapter.GetHyperLinkCount(workitemId),
                            TfsTargetAdapter.GetHyperLinkCount(mirroredId));
        }
示例#3
0
        public void Link_MultipleTest()
        {
            TestEnvironment.CustomActions += new MigrationTestEnvironment.Customize(ConfigCustomizer.CustomActions_DisableContextSync);

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

            WITLinkChangeAction action1 = new WITLinkChangeAction(LinkChangeActionType.Add);

            action1.AddLink(new WITLink("link1"));
            SourceAdapter.UpdateWorkItemLink(workitemId, action1);

            RunAndNoValidate();

            WITLinkChangeAction action2 = new WITLinkChangeAction(LinkChangeActionType.Add);

            action2.AddLink(new WITLink("link2"));
            SourceAdapter.UpdateWorkItemLink(workitemId, action2);

            RunAndNoValidate(true);

            WITLinkChangeAction action3 = new WITLinkChangeAction(LinkChangeActionType.Add);

            action3.AddLink(new WITLink("link3"));
            SourceAdapter.UpdateWorkItemLink(workitemId, action3);

            RunAndNoValidate(true);

            // 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
            });

            int mirroredId = QueryMirroredWorkItemID(workitemId);

            Assert.AreEqual(TfsTargetAdapter.GetHyperLinkCount(mirroredId), 3);
        }
示例#4
0
        public void Link_BasicTest()
        {
            TestEnvironment.CustomActions += new MigrationTestEnvironment.Customize(ConfigCustomizer.CustomActions_DisableContextSync);

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

            WITLinkChangeAction action1 = new WITLinkChangeAction(LinkChangeActionType.Add);

            action1.AddLink(new WITLink("link1"));
            SourceAdapter.UpdateWorkItemLink(workitemId, action1);

            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");

            // validate the conversion history entries
            using (RuntimeEntityModel context = RuntimeEntityModel.CreateInstance())
            {
                string sourceItemId       = workitemId.ToString();
                var    migrationItemQuery =
                    from mi in context.RTMigrationItemSet
                    where mi.ItemId.Equals(sourceItemId) && mi.ItemVersion.Equals("Link")
                    select mi;
                Assert.AreEqual(migrationItemQuery.Count(), 1);

                long miId          = migrationItemQuery.First().Id;
                var  itemPairQuery =
                    from p in context.RTItemRevisionPairSet
                    where p.LeftMigrationItemId == miId || p.RightMigrationItemId == miId
                    select p;
                Assert.AreEqual(itemPairQuery.Count(), 1);
            }

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

            // ignore Area/Iteration path mismatches
            VerifySyncResult(result, new List <string> {
                FIELD_ITERATION_PATH, FIELD_AREA_PATH
            });
        }
示例#5
0
        private void DeleteHyperLinkScenario()
        {
            // add a work item on source side
            string title      = string.Format("{0} {1}", TestContext.TestName, DateTime.Now.ToString("HH'_'mm'_'ss"));
            int    workitemId = SourceAdapter.AddWorkItem("Bug", title, "description1");

            // add a link
            WITLinkChangeAction action1 = new WITLinkChangeAction(LinkChangeActionType.Add);
            WITLink             link1   = new WITLink("link1");

            action1.AddLink(link1);
            SourceAdapter.UpdateWorkItemLink(workitemId, action1);

            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");

            // delete the link
            action1 = new WITLinkChangeAction(LinkChangeActionType.Delete);
            action1.AddLink(link1);
            SourceAdapter.UpdateWorkItemLink(workitemId, action1);

            RunAndNoValidate(true);

            // verify there's no conflicts raised
            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
            });

            // TODO: Remove the following verification once ServerDiff supports link diffing.
            int mirroredId = QueryMirroredWorkItemID(workitemId);

            Assert.AreEqual(TfsSourceAdapter.GetHyperLinkCount(workitemId),
                            TfsTargetAdapter.GetHyperLinkCount(mirroredId));
        }
示例#6
0
        public void Link_UpdateTest()
        {
            TestEnvironment.CustomActions += new MigrationTestEnvironment.Customize(ConfigCustomizer.CustomActions_DisableContextSync);

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

            string location             = "link1";
            WITLinkChangeAction action1 = new WITLinkChangeAction(LinkChangeActionType.Add);

            action1.AddLink(new WITLink(location, "comment1"));
            SourceAdapter.UpdateWorkItemLink(workitemId, action1);

            // update link comment
            string newComment           = "new comment 2";
            WITLinkChangeAction action2 = new WITLinkChangeAction(LinkChangeActionType.Edit);

            action2.AddLink(new WITLink(location, newComment));
            SourceAdapter.UpdateWorkItemLink(workitemId, action2);

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

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

            // Title <-> Description
            int mirroredId = QueryTargetWorkItemID(workitemId);

            Assert.AreEqual(TfsTargetAdapter.GetHyperLinkCount(mirroredId), 1);
            WITLink tarLink = TargetAdapter.GetHyperLink(mirroredId, location);

            Assert.AreEqual(tarLink.Comment, newComment);
        }
示例#7
0
        public void Linking_BasicLinkTest()
        {
            TestEnvironment.CustomActions += new MigrationTestEnvironment.Customize(TestEnvironment_AddCQWebUrlBase);
            TestEnvironment.CustomActions += new MigrationTestEnvironment.Customize(TestEnvironment_AddCQHyperLinkTypeMapping);

            // add a work item on source side
            int workitemId = SourceAdapter.AddWorkItem("Bug", "title", "description1");

            WITLinkChangeAction action1 = new WITLinkChangeAction(LinkChangeActionType.Add);

            action1.AddLink(new WITLink("link1"));
            SourceAdapter.UpdateWorkItemLink(workitemId, action1);

            RunAndNoValidate();

            // verify there's no conflicts raised
            VerifyNoConflicts();

            string sourceHyperLinkUrl = string.Format(TestCQHyperLinkBaseUrl, workitemId.ToString());

            // verify migration result
            VerifySyncResult();
        }