Exemple #1
0
        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);
        }
Exemple #2
0
        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();
        }
Exemple #3
0
        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);
        }
Exemple #4
0
        private int AddIteration(IIterationManager manager, out string iterationPath)
        {
            int notExpected = manager.ListIterations().Count;

            iterationPath = GetRandomGuid();
            manager.AddNewIteration(iterationPath, null, null);
            int actual = manager.ListIterations().Count;

            Assert.AreNotEqual(notExpected, actual, "Adding an Iteration to delete returned unexpected count");
            return(notExpected);
        }
Exemple #5
0
        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.");
        }
Exemple #6
0
        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);
            }
        }
Exemple #7
0
        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);
        }
Exemple #8
0
        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);
        }
Exemple #9
0
        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));
        }
        private int AddIteration(IIterationManager manager, out string iterationPath)
        {
            int notExpected = manager.ListIterations().Count;
            iterationPath = GetRandomGuid();
            manager.AddNewIteration(iterationPath, null, null);
            int actual = manager.ListIterations().Count;

            Assert.AreNotEqual(notExpected, actual, "Adding an Iteration to delete returned unexpected count");
            return notExpected;
        }