private void AddAreaAndCheckEnabledOnBacklog(string teamName, bool enableForTeam) { // arrange ProjectDetail projectDetail = TestConstants.TfsTeamProjectDetail; List <ProjectArea> initialList; List <ProjectArea> finalList; string newAreaName = null; IAreaManager manager = AreaManagerFactory.GetManager(projectDetail); ITeamManager teamManager = TeamManagerFactory.GetManager(projectDetail); initialList = manager.ListAreas(); newAreaName = "Area " + GetRandomGuid(); // act manager.AddNewArea(newAreaName, new List <ITfsTeam> { enableForTeam?teamManager.GetTfsTeam(teamName) : null }); // assert finalList = manager.ListAreas(); int expected = initialList.Count + 1; int actual = finalList.Count; Assert.AreEqual(expected, actual); ProjectArea addedItem = (from o in finalList where o.Name == newAreaName select o).FirstOrDefault(); Assert.IsNotNull(addedItem); Assert.AreEqual(enableForTeam, teamManager.GetTfsTeam(teamName).IsAreaPathEnabled(newAreaName)); }
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)); }