public void AddIteration_passingInProjectDetails_IterationCountGoesUpByOne() { // arrange ProjectDetail projectDetail = this.CreateProjectDetail(); List <ProjectIteration> initialList; List <ProjectIteration> finalList; IIterationManager manager = IterationManagerFactory.GetManager(projectDetail); initialList = manager.ListIterations(); string newIterationName = "Iteration " + GetRandomGuid(); DateTime?startDate = DateTime.Now; DateTime?endDate = DateTime.Now.AddDays(10); // act manager.AddNewIteration(newIterationName, startDate, endDate); // assert finalList = manager.ListIterations(); int expected = initialList.Count + 1; int actual = finalList.Count; Assert.AreEqual(expected, actual); manager.Dispose(); }
public void AddIteration_passingInProjectDetailsWithThreeLevelsOfIterationsAllCompletelyNew_IterationGoesUpByOneOnTopLevelAndTwoLevelsDownAreCreated() { // arrange ProjectDetail projectDetail = this.CreateProjectDetail(); List <ProjectIteration> initialList; List <ProjectIteration> finalList; bool fullExpectedPathExists = false; using (IIterationManager manager = IterationManagerFactory.GetManager(projectDetail)) { initialList = manager.ListIterations(); string newIterationName = "Top Level " + GetRandomGuid() + "\\Level Two\\Level Three"; DateTime?startDate = DateTime.Now; DateTime?endDate = DateTime.Now.AddDays(10); // act manager.AddNewIteration(newIterationName, startDate, endDate); // assert finalList = manager.ListIterations(); fullExpectedPathExists = manager.CheckIfPathAlreadyExists(newIterationName); } int expectedRoot = initialList.Count + 1; int actualRoot = finalList.Count; // check root level iteration count Assert.AreEqual(expectedRoot, actualRoot); // check newly added top level node has 1 child and that child has 1 child Assert.IsTrue(fullExpectedPathExists); }
private void LoadIterationPaths() { IterationPaths = new List <ProjectIteration>(); IIterationManager iterationManager = IterationManagerFactory.GetManager(ProjectDetails, tfsCredentials); IterationPaths.AddRange(iterationManager.FlattenIterations(iterationManager.ListIterations()).Where(o => TeamConfiguration.TeamSettings.IterationPaths.Contains(o.FullPath))); }
public void AddIteration_passingInProjectDetailsWithThreeLevelsOfIterations_IterationCountStaysTheSameButTheChildOfChildIterationCountOfTheFirstIterationGoesUpByOne() { // arrange ProjectDetail projectDetail = this.CreateProjectDetail(); List <ProjectIteration> initialList; ProjectIteration initialFirstIteration; List <ProjectIteration> finalList; ProjectIteration finalFirstIteration; using (IIterationManager manager = IterationManagerFactory.GetManager(projectDetail)) { initialList = manager.ListIterations(); if (initialList.Count == 0) { Assert.Fail("No iterations found yet to add a duplication of"); } ProjectIteration[] listOfIterations = initialList.Where(o => o.Children.Count > 0).ToArray(); if (listOfIterations.Length == 0) { Assert.Fail("No iterations found in the first interation yet to add a duplication of"); } listOfIterations = listOfIterations.Where(o => o.Children.Count > 0).ToArray(); if (listOfIterations.Length == 0) { Assert.Fail("The first interation has no children yet to add a duplication of"); } ProjectIteration firstIteration = listOfIterations[0]; initialFirstIteration = firstIteration.Children[0]; string newIterationName = firstIteration.Name + "\\" + initialFirstIteration.Name + "\\Iteration " + GetRandomGuid(); DateTime?startDate = DateTime.Now; DateTime?endDate = DateTime.Now.AddDays(10); // act manager.AddNewIteration(newIterationName, startDate, endDate); // assert finalList = manager.ListIterations(); listOfIterations = finalList.Where(o => o.Children.Count > 0).ToArray(); listOfIterations = listOfIterations.Where(o => o.Children.Count > 0).ToArray(); finalFirstIteration = listOfIterations[0].Children[0]; } int expectedRoot = initialList.Count; int actualRoot = finalList.Count; // check root level Area count Assert.AreEqual(expectedRoot, actualRoot); int expectedChild = initialFirstIteration.Children.Count + 1; int actualChild = finalFirstIteration.Children.Count; // check child level Area count Assert.AreEqual(expectedChild, actualChild); }
public void DeleteIteration_passInNull_ArgumentNullException() { // arrange ProjectDetail projectDetail = this.CreateProjectDetail(); IIterationManager manager = IterationManagerFactory.GetManager(projectDetail); // act manager.DeleteIteration(null); // assert }
public void DeleteIterationUsingIterationPath_passInAInValidIterationPath_ExceptionExpected() { // arrange ProjectDetail projectDetail = this.CreateProjectDetail(); IIterationManager manager = IterationManagerFactory.GetManager(projectDetail); // act manager.DeleteIterationUsingIterationPath(GetRandomGuid()); // assert }
public void Ctor_passingInProjectDetails_InstanceOfIterationManager() { // arrange ProjectDetail projectDetail = this.CreateProjectDetail(); // act IIterationManager manager = IterationManagerFactory.GetManager(projectDetail); // assert Assert.IsInstanceOfType(manager, typeof(IIterationManager)); }
public void ListIterations_passingInProjectDetails_IterationListReturnMoreThanZeroResults() { // arrange ProjectDetail projectDetail = this.CreateProjectDetail(); IIterationManager manager = IterationManagerFactory.GetManager(projectDetail); // act List <ProjectIteration> list = manager.ListIterations(); // assert Assert.IsTrue(list.Count > 0); }
public void ListIterations_passingInProjectDetails_InstanceOfListOfIterations() { // arrange ProjectDetail projectDetail = this.CreateProjectDetail(); IIterationManager manager = IterationManagerFactory.GetManager(projectDetail); // act List <ProjectIteration> list = manager.ListIterations(); // assert Assert.IsInstanceOfType(list, typeof(List <ProjectIteration>)); }
public void EnableDisableIterationPath_passingInNewPath_ShouldEnablePathAndThenDisablePath() { // arrange ProjectDetail projectDetail = TestConstants.TfsTeamProjectDetail; IIterationManager manager = IterationManagerFactory.GetManager(projectDetail); string newIterationName = GetRandomGuid(); manager.AddNewIteration(newIterationName); manager.EnableIterationPath(TestConstants.TfsTeam, newIterationName, true); Assert.IsTrue(manager.IsIterationPathEnabled(TestConstants.TfsTeam, newIterationName), "Iteration path did not enable for team."); manager.DisableIterationPath(TestConstants.TfsTeam, newIterationName); Assert.IsFalse(manager.IsIterationPathEnabled(TestConstants.TfsTeam, newIterationName), "Iteration path did not disable for team."); }
public void Ctor_disposeOfObject_NoErrorThrown() { // arrange ProjectDetail projectDetail = this.CreateProjectDetail(); // act using (IIterationManager manager = IterationManagerFactory.GetManager(projectDetail)) { manager.Dispose(); } // assert Assert.IsTrue(1 == 1); }
public void AddIteration_passingInProjectDetailsAndAnExistingIterationName_ExceptionThrown() { // arrange ProjectDetail projectDetail = this.CreateProjectDetail(); using (IIterationManager manager = IterationManagerFactory.GetManager(projectDetail)) { const string newIterationName = "Iteration 1"; DateTime? startDate = DateTime.Now; DateTime? endDate = DateTime.Now.AddDays(10); // act manager.AddNewIteration(newIterationName, startDate, endDate); } }
public void DeleteIterationUsingIterationPath_passInAValidIterationPath_ListIterationsReturnLess1ThanBeforeDelele() { // arrange ProjectDetail projectDetail = this.CreateProjectDetail(); IIterationManager manager = IterationManagerFactory.GetManager(projectDetail); string iterationPath; int expected = this.AddIteration(manager, out iterationPath); // act manager.DeleteIterationUsingIterationPath(iterationPath); // assert int actual = manager.ListIterations().Count; Assert.AreEqual(expected, actual); }
public void IsIterationPathVisibleForIterationPlanning_passingInAnyPathAfterCreatingANewTeam_ShouldReturnFalse() { // arrange ProjectDetail projectDetail = this.CreateProjectDetail(); ITeamManager teamManager = TeamManagerFactory.GetManager(projectDetail); var tfsTeamName = GetRandomGuid() + "Team"; ITfsTeam tfsTeam = teamManager.AddTeam(tfsTeamName); IIterationManager manager = IterationManagerFactory.GetManager(projectDetail); bool actual = false; // act actual = manager.IsIterationPathEnabled(tfsTeam, GetRandomGuid()); // assert Assert.IsFalse(actual); }
public void IsIterationPathVisibleForIterationPlanning_passingInAPathThatIsAssignedToATeamAfterItHasBeenCreated_ShouldReturnTrue() { // arrange ProjectDetail projectDetail = this.CreateProjectDetail(); ITeamManager teamManager = TeamManagerFactory.GetManager(projectDetail); var tfsTeamName = GetRandomGuid() + "Team"; ITfsTeam tfsTeam = teamManager.AddTeam(tfsTeamName); IIterationManager manager = IterationManagerFactory.GetManager(projectDetail); string newIterationName = GetRandomGuid(); manager.AddNewIteration(newIterationName); bool actual = false; // act actual = manager.IsIterationPathEnabled(tfsTeam, newIterationName); // assert Assert.IsFalse(actual); }
private void DefaultTeamSettings(bool tryAddDefaultIterationPath = false) { if (tryAddDefaultIterationPath) { if (string.IsNullOrEmpty(TeamConfiguration.TeamSettings.BacklogIterationPath)) { TeamConfiguration.TeamSettings.BacklogIterationPath = ProjectDetails.ProjectName; } if (TeamConfiguration.TeamSettings.IterationPaths == null || TeamConfiguration.TeamSettings.IterationPaths.Length == 0) { IIterationManager iterationManager = IterationManagerFactory.GetManager(ProjectDetails, tfsCredentials); TeamConfiguration.TeamSettings.IterationPaths = iterationManager.ListIterations().Select(o => o.FullPath).ToArray(); } } if (TeamConfiguration.TeamSettings.TeamFieldValues == null || TeamConfiguration.TeamSettings.TeamFieldValues.Length == 0) { TeamConfiguration.TeamSettings.TeamFieldValues = new TeamFieldValue[] { new TeamFieldValue { IncludeChildren = true, Value = this.ProjectDetails.ProjectName } }; } }
public void AddIteration_passingInProjectDetailsWithTwoLevelsOfIterations_IterationCountStaysTheSameButTheChildIterationCountOfTheFirstIterationGoesUpByOne() { // arrange ProjectDetail projectDetail = this.CreateProjectDetail(); List <ProjectIteration> initialList; ProjectIteration initialFirstIteration; List <ProjectIteration> finalList; ProjectIteration finalFirstIteration; using (IIterationManager manager = IterationManagerFactory.GetManager(projectDetail)) { initialList = manager.ListIterations(); initialFirstIteration = initialList[0]; string newIterationName = initialFirstIteration.Name + "\\Iteration " + GetRandomGuid(); DateTime?startDate = DateTime.Now; DateTime?endDate = DateTime.Now.AddDays(10); // act manager.AddNewIteration(newIterationName, startDate, endDate); // assert finalList = manager.ListIterations(); finalFirstIteration = finalList[0]; } int expectedRoot = initialList.Count; int actualRoot = finalList.Count; // check root level iteration count Assert.AreEqual(expectedRoot, actualRoot); int expectedChild = initialFirstIteration.Children.Count + 1; int actualChild = finalFirstIteration.Children.Count; // check child level iteration count Assert.AreEqual(expectedChild, actualChild); }
private void AddIterationAndCheckEnabledOnBacklog(string teamName, bool addToBacklogForTeam) { // arrange ProjectDetail projectDetail = this.CreateProjectDetail(); List <ProjectIteration> initialList; List <ProjectIteration> finalList; string newIterationName = null; IIterationManager manager = IterationManagerFactory.GetManager(projectDetail); ITeamManager teamManager = TeamManagerFactory.GetManager(projectDetail); initialList = manager.ListIterations(); newIterationName = "Iteration " + GetRandomGuid(); DateTime?startDate = DateTime.Now; DateTime?endDate = DateTime.Now.AddDays(10); // act manager.AddNewIteration(newIterationName, startDate, endDate, new List <ITfsTeam> { addToBacklogForTeam?teamManager.GetTfsTeam(teamName) : null }); // assert finalList = manager.ListIterations(); int expected = initialList.Count + 1; int actual = finalList.Count; Assert.AreEqual(expected, actual); ProjectIteration addedItem = (from o in finalList where o.Name == newIterationName select o).FirstOrDefault(); Assert.IsNotNull(addedItem); Assert.AreEqual(addToBacklogForTeam, teamManager.GetTfsTeam(teamName).IsIterationPathEnabled(newIterationName)); }