public void IntegrationTest_TrackChanges_Publish_ShouldDeactivteTrackChanges() { var serverConfig = CommonConfiguration.TfsTestServerConfiguration(_testContext); serverConfig.Configuration.IgnoreFormatting = true; // import var importItems = GetTfsWorkItems(new[] { serverConfig.HtmlRequirementId }, serverConfig).ToList(); Refresh(serverConfig, importItems); //Set Track changes to true bool trackRevisionsBefore = _document.TrackRevisions; // change _document.Tables[1].Cell(3, 1).Range.Text = Guid.NewGuid().ToString(); _document.Tables[1].Cell(3, 1).Range.Font.Color = WdColor.wdColorDarkRed; // publish var publishWorkItems = GetWordWorkItems(new[] { serverConfig.HtmlRequirementId }, serverConfig).ToList(); Publish(serverConfig, publishWorkItems, false); //Revisions should be the same after publish Assert.AreEqual(_document.TrackRevisions, trackRevisionsBefore); }
public void IntegrationTest_HTMLField_PublishTwice_ShouldNotIncreaseRevisionSecondTime() { var serverConfig = CommonConfiguration.TfsTestServerConfiguration(_testContext); serverConfig.Configuration.IgnoreFormatting = true; // import var importItems = GetTfsWorkItems(new[] { serverConfig.HtmlRequirementId }, serverConfig).ToList(); Refresh(serverConfig, importItems); // change _document.Tables[1].Cell(3, 1).Range.Text = Guid.NewGuid().ToString(); _document.Tables[1].Cell(3, 1).Range.Font.Color = WdColor.wdColorDarkRed; // publish var publishWorkItems = GetWordWorkItems(new[] { serverConfig.HtmlRequirementId }, serverConfig).ToList(); Publish(serverConfig, publishWorkItems, false); var firstRevision = GetTfsWorkItems(new[] { serverConfig.HtmlRequirementId }, serverConfig).Single().Revision; Publish(serverConfig, publishWorkItems, false); var secondRevision = GetTfsWorkItems(new[] { serverConfig.HtmlRequirementId }, serverConfig).Single().Revision; Assert.AreEqual(firstRevision, secondRevision, "Revision changed after second publish."); }
public void MyTestInitialize() { var config = CommonConfiguration.GetSimpleFieldConfiguration("Requirement", Direction.OtherToTfs, FieldValueType.PlainText, "System.Title"); var serverConfiguration = CommonConfiguration.TfsTestServerConfiguration(_testContext); _testAdapter = SyncServiceFactory.CreateTfsTestAdapter(serverConfiguration.TeamProjectCollectionUrl, serverConfiguration.TeamProjectName, config); }
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(); }
public static void MyClassInitialize(TestContext testContext) { _testContext = testContext; CommonConfiguration.ReplaceConfigFileTokens(_testContext); Server = CommonConfiguration.TfsTestServerConfiguration(_testContext).TeamProjectCollectionUrl; Project = CommonConfiguration.TfsTestServerConfiguration(_testContext).TeamProjectName; WorkItemToImport = CommonConfiguration.TfsTestServerConfiguration(_testContext).HtmlRequirementId.ToString(); }
public void TestInitialize() { _testServerConfiguration = CommonConfiguration.TfsTestServerConfiguration(_testContext); // ReSharper disable once UnusedVariable var projectCollection = TfsTeamProjectCollectionFactory.GetTeamProjectCollection(new Uri(_testServerConfiguration.TeamProjectCollectionUrl)); CreateAdapterForTeamProject(); GetWorkItemsRelevantForTheseTests(); }
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 static void MyClassInitialize(TestContext testContext) { _testContext = testContext; CommonConfiguration.ReplaceConfigFileTokens(_testContext); //Init the assemblies AIT.TFS.SyncService.Service.AssemblyInit.Instance.Init(); AIT.TFS.SyncService.Adapter.TFS2012.AssemblyInit.Instance.Init(); var serverConfiguration = CommonConfiguration.TfsTestServerConfiguration(_testContext); projectCollection = TfsTeamProjectCollectionFactory.GetTeamProjectCollection(new Uri(serverConfiguration.TeamProjectCollectionUrl)); testManagement = projectCollection.GetService <ITestManagementService>().GetTeamProject(serverConfiguration.TeamProjectName); InitializeTestData(); }
public void IntegrationTest_HTMLField_Refresh_MustNotOverwriteDifferentWordFormatting() { var serverConfig = CommonConfiguration.TfsTestServerConfiguration(_testContext); serverConfig.Configuration.IgnoreFormatting = true; // import var importItems = GetTfsWorkItems(new[] { serverConfig.HtmlRequirementId }, serverConfig).ToList(); Refresh(serverConfig, importItems); // change _document.Tables[1].Cell(3, 1).Range.Font.Color = WdColor.wdColorDarkGreen; // refresh Refresh(serverConfig, GetWordWorkItems(null, serverConfig)); Assert.AreEqual(WdColor.wdColorDarkGreen, _document.Tables[1].Cell(3, 1).Range.Font.Color); }
public void IntegrationTest_HTMLField_GetPublish_ShouldNotIncreaseRevision() { var serverConfig = CommonConfiguration.TfsTestServerConfiguration(_testContext); serverConfig.Configuration.IgnoreFormatting = true; // import var importItems = GetTfsWorkItems(new[] { serverConfig.HtmlRequirementId }, serverConfig).ToList(); var oldRevision = importItems.Single().Revision; Refresh(serverConfig, importItems); // publish var publishWorkItems = GetWordWorkItems(new[] { serverConfig.HtmlRequirementId }, serverConfig).ToList(); Publish(serverConfig, publishWorkItems, false); // get published item var publishedItems = GetTfsWorkItems(new[] { serverConfig.HtmlRequirementId }, serverConfig).ToList(); var newRevision = publishedItems.Single().Revision; Assert.IsTrue(publishedItems.Single().Fields[serverConfig.HtmlFieldReferenceName].Value.Contains("<"), "Ait.Common.Description must contain html data."); Assert.AreEqual(oldRevision, newRevision, "Revision changed after Get/Publish"); }
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); }
public static void MyClassInitialize(TestContext testContext) { _testContext = testContext; AIT.TFS.SyncService.Service.AssemblyInit.Instance.Init(); AIT.TFS.SyncService.Adapter.TFS2012.AssemblyInit.Instance.Init(); var serverConfig = CommonConfiguration.TfsTestServerConfiguration(_testContext); CommonConfiguration.ReplaceConfigFileTokens(_testContext); var config = CommonConfiguration.GetSimpleFieldConfiguration("Requirement", Direction.OtherToTfs, FieldValueType.PlainText, "System.Title"); _testAdapter = SyncServiceFactory.CreateTfsTestAdapter(serverConfig.TeamProjectCollectionUrl, serverConfig.TeamProjectName, config); var projectCollection = TfsTeamProjectCollectionFactory.GetTeamProjectCollection(new Uri(serverConfig.TeamProjectCollectionUrl)); _testManagement = projectCollection.GetService <ITestManagementService>().GetTeamProject(serverConfig.TeamProjectName); var sharedSteps = _testManagement.SharedSteps.Query("SELECT * FROM WorkItems WHERE System.Title='UnitTest_SharedStep'"); _sharedStep = sharedSteps.FirstOrDefault(); if (_sharedStep == null) { _sharedStep = _testManagement.SharedSteps.Create(); var sharedStep1 = _sharedStep.CreateTestStep(); sharedStep1.Title = "First Shared Step"; sharedStep1.ExpectedResult = "Result of first shared step"; var sharedStep2 = _sharedStep.CreateTestStep(); sharedStep2.Title = "Second Shared Step .: @ParametersDontLikeSpecialChars"; sharedStep2.ExpectedResult = "Result of second shared step"; _sharedStep.Actions.Add(sharedStep1); _sharedStep.Actions.Add(sharedStep2); _sharedStep.Title = "UnitTest_SharedStep_1"; _sharedStep.Save(); } else { var sharedStep1 = _sharedStep.Actions[0] as ITestStep; if (sharedStep1 != null) { sharedStep1.Title = "First Shared Step"; sharedStep1.ExpectedResult = "Result of first shared step"; } var sharedStep2 = _sharedStep.Actions[1] as ITestStep; if (sharedStep2 != null) { sharedStep2.Title = "Second Shared Step .: @ParametersDontLikeSpecialChars"; sharedStep2.ExpectedResult = "Result of second shared step"; } _sharedStep.WorkItem.Open(); _sharedStep.Save(); } var testCases = _testManagement.TestCases.Query("SELECT * FROM WorkItems WHERE System.Title='UnitTest_TestCase'"); _testCase = testCases.FirstOrDefault(); if (_testCase == null) { _testCase = _testManagement.TestCases.Create(); _testCase.Title = "UnitTest_TestCase"; var step1 = _testCase.CreateTestStep(); step1.Title = "First Step"; step1.ExpectedResult = "Result of first step"; var step2 = _testCase.CreateTestStep(); step2.Title = "Second Step"; step2.ExpectedResult = "Result of second step"; var step3 = _testCase.CreateTestStep(); step3.Title = "@DescriptionParameter"; step3.ExpectedResult = "@ExpectedResultParameter"; var ssr = _testCase.CreateSharedStepReference(); ssr.SharedStepId = _sharedStep.Id; _testCase.Actions.Add(step1); _testCase.Actions.Add(step2); _testCase.Actions.Add(ssr); _testCase.Actions.Add(step3); _testCase.Save(); } var testConfigurations = _testManagement.TestConfigurations.Query("Select * from TestConfiguration where Name='UnitTest_TestConfiguration'"); _testConfiguration = testConfigurations.FirstOrDefault(); if (_testConfiguration == null) { _testConfiguration = _testManagement.TestConfigurations.Create(); _testConfiguration.Name = "UnitTest_TestConfiguration"; _testConfiguration.Save(); } }
public static void MyClassInitialize(TestContext testContext) { _testContext = testContext; CommonConfiguration.ReplaceConfigFileTokens(_testContext); // ReSharper disable once UnusedVariable var projectCollection = TfsTeamProjectCollectionFactory.GetTeamProjectCollection(new Uri(CommonConfiguration.TfsTestServerConfiguration(_testContext).TeamProjectCollectionUrl)); AIT.TFS.SyncService.Service.AssemblyInit.Instance.Init(); }
public static void MyClassInitialize(TestContext testContext) { _testContext = testContext; CommonConfiguration.ReplaceConfigFileTokens(_testContext); // ReSharper disable once CSharpWarnings::CS0618 projectCollection = TfsTeamProjectCollectionFactory.GetTeamProjectCollection(new Uri(CommonConfiguration.TfsTestServerConfiguration(_testContext).TeamProjectCollectionUrl)); AIT.TFS.SyncService.Service.AssemblyInit.Instance.Init(); AIT.TFS.SyncService.Adapter.TFS2012.AssemblyInit.Instance.Init(); AIT.TFS.SyncService.Adapter.Word2007.AssemblyInit.Instance.Init(); }