public void SynchronizedWorkItemViewModel_SynchronizationState_ShouldBeNotImported() { var config = CommonConfiguration.GetSimpleFieldConfiguration("Requirement", Direction.OtherToTfs, FieldValueType.PlainText, "System.Title"); OpenAdapters(CommonConfiguration.TfsTestServerConfiguration(_testContext), config); _synchronizedWorkItemViewModel = new SynchronizedWorkItemViewModel(_tfsAdapter.WorkItems.First(), null, _wordAdapter, _documentModel.Object, null); _synchronizedWorkItemViewModel.Refresh(); Assert.AreEqual(SynchronizationState.NotImported, _synchronizedWorkItemViewModel.SynchronizationState); }
public void SynchronizedWorkItemViewModel_SynchronizationState_ShouldBeNew() { var config = CommonConfiguration.GetSimpleFieldConfiguration("Requirement", Direction.OtherToTfs, FieldValueType.PlainText, "System.Title"); OpenAdapters(CommonConfiguration.TfsTestServerConfiguration(_testContext), config); _wordAdapter.CreateNewWorkItem(config.GetConfigurationItems().First()); _wordAdapter.WorkItems.First().Fields["System.Title"].Value = "Was anderes"; _wordAdapter = new Word2007TableSyncAdapter(_document, config); _wordAdapter.Open(null); _synchronizedWorkItemViewModel = new SynchronizedWorkItemViewModel(null, _wordAdapter.WorkItems.First(), _wordAdapter, _documentModel.Object, null); _synchronizedWorkItemViewModel.Refresh(); Assert.AreEqual(SynchronizationState.New, _synchronizedWorkItemViewModel.SynchronizationState); }
public void SynchronizedWorkItemViewModel_SynchronizationState_ShouldBeDivergedWithConflicts() { var config = CommonConfiguration.GetSimpleFieldConfiguration("Requirement", Direction.OtherToTfs, FieldValueType.PlainText, "System.Title"); config.GetConfigurationItems().First().FieldConfigurations.Add(new ConfigurationFieldItem("System.AreaPath", "", FieldValueType.PlainText, Direction.OtherToTfs, 5, 1, "", false, HandleAsDocumentType.OleOnDemand, null, null, null, ShapeOnlyWorkaroundMode.AddSpace, null, null, null)); OpenAdapters(CommonConfiguration.TfsTestServerConfiguration(_testContext), config); var tfsItem = _tfsAdapter.WorkItems.First(); var oldFields = tfsItem.GetWorkItemByRevision(tfsItem.Revision - 1); Assert.AreNotEqual(tfsItem.Fields["System.AreaPath"].Value, oldFields["System.AreaPath"].Value); _wordAdapter.CreateNewWorkItem(config.GetConfigurationItems().First()); _wordAdapter.WorkItems.First().Fields["System.Title"].Value = "Test"; _wordAdapter.WorkItems.First().Fields["System.Id"].Value = oldFields["System.Id"].Value; _wordAdapter.WorkItems.First().Fields["System.Rev"].Value = oldFields["System.Rev"].Value; _wordAdapter.WorkItems.First().Fields["System.AreaPath"].Value = oldFields["System.AreaPath"].Value; _wordAdapter = new Word2007TableSyncAdapter(_document, config); _wordAdapter.Open(null); _synchronizedWorkItemViewModel = new SynchronizedWorkItemViewModel(_tfsAdapter.WorkItems.First(), null, _wordAdapter, _documentModel.Object, null); _synchronizedWorkItemViewModel.Refresh(); Assert.AreEqual(SynchronizationState.DivergedWithConflicts, _synchronizedWorkItemViewModel.SynchronizationState); }
public void SynchronizedWorkItemViewModel_SynchronizationState_ShouldBeUpToDate_WithStackRankSetToTrue() { var config = CommonConfiguration.GetSimpleFieldConfiguration("Requirement", Direction.OtherToTfs, FieldValueType.PlainText, "System.Title"); OpenAdapters(CommonConfiguration.TfsTestServerConfiguration(_testContext), config); config.UseStackRank = true; //add the stack rank configuration and a value _tfsAdapter.WorkItems.First().Configuration.FieldConfigurations.Add(new ConfigurationFieldItem("Microsoft.VSTS.Common.StackRank", string.Empty, FieldValueType.PlainText, Direction.OtherToTfs, 0, 0, string.Empty, false, HandleAsDocumentType.All, null, string.Empty, null, ShapeOnlyWorkaroundMode.AddSpace, false, null, null, null)); _tfsAdapter.WorkItems.First().Fields["Microsoft.VSTS.Common.StackRank"].Value = "3000"; _wordAdapter.CreateNewWorkItem(config.GetConfigurationItems().First()); _wordAdapter.WorkItems.First().Fields["System.Title"].Value = _tfsAdapter.WorkItems.First().Fields["System.Title"].Value; _wordAdapter.WorkItems.First().Fields["System.Id"].Value = _tfsAdapter.WorkItems.First().Fields["System.Id"].Value; _wordAdapter.WorkItems.First().Fields["System.Rev"].Value = _tfsAdapter.WorkItems.First().Fields["System.Rev"].Value; _wordAdapter.WorkItems.First().Configuration.FieldConfigurations.Add(new ConfigurationFieldItem("Microsoft.VSTS.Common.StackRank", string.Empty, FieldValueType.PlainText, Direction.OtherToTfs, 0, 0, string.Empty, false, HandleAsDocumentType.All, null, string.Empty, null, ShapeOnlyWorkaroundMode.AddSpace, false, null, null, null)); _wordAdapter = new Word2007TableSyncAdapter(_document, config); _wordAdapter.Open(null); _synchronizedWorkItemViewModel = new SynchronizedWorkItemViewModel(_tfsAdapter.WorkItems.First(), null, _wordAdapter, _documentModel.Object, null); _synchronizedWorkItemViewModel.Refresh(); Assert.AreEqual(SynchronizationState.UpToDate, _synchronizedWorkItemViewModel.SynchronizationState); }