Ejemplo n.º 1
0
        public void GetInvalidItemById()
        {
            IWorkItemSyncService service = new WorkItemSyncService(_teamWorkItemService);

            Business.Dto.WorkItemDto obj = service.GetWorkItemById(1913745, 5, "1111111");
            Assert.IsNull(obj);
        }
Ejemplo n.º 2
0
        public void GetUserIncompleteItems()
        {
            IWorkItemSyncService            service = new WorkItemSyncService(_teamWorkItemService);
            List <Business.Dto.WorkItemDto> obj     = service.GetUserIncompleteSyncedTasks(1, "1111111");

            Assert.IsTrue(obj.Count > 0);
        }
Ejemplo n.º 3
0
        public void GetValidItemById()
        {
            IWorkItemSyncService service = new WorkItemSyncService(_teamWorkItemService);

            Business.Dto.WorkItemDto obj = service.GetWorkItemById(200052, 1, "1111111");
            Assert.IsNotNull(obj);
        }
Ejemplo n.º 4
0
        public void GetCurrentWeekTasks()
        {
            IWorkItemSyncService            userWorkItemManagementService = new WorkItemSyncService(_teamWorkItemService);
            List <Business.Dto.WorkItemDto> currentWeekTasks = userWorkItemManagementService.GetUserCurrentWeekSyncedTasks("1111111");

            Assert.IsTrue(currentWeekTasks.Count > 0);
        }
Ejemplo n.º 5
0
        public void IntegrationTest_PublishOfWorkItemWithUnclosedList_ShouldNotBePublished()
        {
            var systemVariableMock = new Mock <ISystemVariableService>();

            _ignoreFailOnUserInforation = true;

            var serverConfig = CommonConfiguration.TfsTestServerConfiguration(_testContext);

            serverConfig.Configuration.IgnoreFormatting = false;
            var requirementConf = serverConfig.Configuration.GetWorkItemConfiguration("Requirement");

            // import an workitems to use the structure as example for the new workitem
            var importItems = GetTfsWorkItems(new[] { serverConfig.HtmlRequirementId }, serverConfig).ToList();

            Refresh(serverConfig, importItems);

            //Add Bullet points to the table.
            _document.Tables[1].Cell(3, 1).Range.ListFormat.ApplyBulletDefault();
            var bulletItems = new[] { "One", "Two", "Three" };

            for (int i = 0; i < bulletItems.Length; i++)
            {
                string bulletItem = bulletItems[i];
                if (i < bulletItems.Length - 1)
                {
                    bulletItem = bulletItem + "\n";
                }
                _document.Tables[1].Cell(3, 1).Range.InsertBefore(bulletItem);
            }

            //delete the id
            _document.Tables[1].Cell(2, 3).Range.Text = string.Empty;
            _document.Tables[1].Cell(2, 1).Range.Text = "TestTitle";

            var createdWorkItem = new WordTableWorkItem(_document.Tables[1], "Requirement", serverConfig.Configuration, requirementConf);

            // publish
            var publishWorkItems = new List <IWorkItem>();

            publishWorkItems.Add(createdWorkItem);

            var configuration = serverConfig.Configuration;
            var tfsAdapter    = new Tfs2012SyncAdapter(serverConfig.TeamProjectCollectionUrl, serverConfig.TeamProjectName, null, configuration);
            var wordAdapter   = new Word2007TableSyncAdapter(_document, configuration);

            var syncService = new WorkItemSyncService(systemVariableMock.Object);

            syncService.Publish(wordAdapter, tfsAdapter, publishWorkItems, false, configuration);

            //Get the information storage
            var informationStorage = SyncServiceFactory.GetService <IInfoStorageService>();
            var error = informationStorage.UserInformation.FirstOrDefault(x => x.Type == UserInformationType.Error);

            //Test that an error was thrown
            Assert.IsNotNull(error);

            //Clear the information storage
            informationStorage.UserInformation.Clear();
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Helper method to refresh information
        /// </summary>
        /// <param name="serverConfiguration"></param>
        /// <param name="workItems"></param>
        private void Refresh(ServerConfiguration serverConfiguration, IEnumerable <IWorkItem> workItems)
        {
            var systemVariableMock = new Mock <ISystemVariableService>();
            var configuration      = serverConfiguration.Configuration;
            var tfsAdapter         = new Tfs2012SyncAdapter(serverConfiguration.TeamProjectCollectionUrl, serverConfiguration.TeamProjectName, null, configuration);
            var wordAdapter        = new Word2007TableSyncAdapter(_document, configuration);

            var syncService = new WorkItemSyncService(systemVariableMock.Object);

            syncService.Refresh(tfsAdapter, wordAdapter, workItems, configuration);
            FailOnUserInformation();
        }