Exemplo n.º 1
0
        private void LoadAreaPaths()
        {
            AreaPaths = new List <ProjectArea>();
            IAreaManager areaManager = AreaManagerFactory.GetManager(ProjectDetails, tfsCredentials);

            AreaPaths.AddRange(areaManager.FlattenAreas(areaManager.ListAreas()).Where(o => ReadTeamAreaPaths().Contains(o.FullPath)));
        }
Exemplo n.º 2
0
        public void Ctor_passingInProjectDetails_InstanceOfAreaManager()
        {
            // arrange
            ProjectDetail projectDetail = TestConstants.TfsTeamProjectDetail;

            // act
            IAreaManager manager = AreaManagerFactory.GetManager(projectDetail);

            // assert
            Assert.IsInstanceOfType(manager, typeof(IAreaManager));
        }
Exemplo n.º 3
0
        public void DeleteArea_passInNull_ArgumentNullException()
        {
            // arrange
            ProjectDetail projectDetail = TestConstants.TfsTeamProjectDetail;
            IAreaManager  manager       = AreaManagerFactory.GetManager(projectDetail);

            // act
            manager.DeleteArea(null);

            // assert
        }
Exemplo n.º 4
0
        public void DeleteAreaUsingAreaPath_passInAInValidAreaPath_ExceptionExpected()
        {
            // arrange
            ProjectDetail projectDetail = TestConstants.TfsTeamProjectDetail;
            IAreaManager  manager       = AreaManagerFactory.GetManager(projectDetail);

            // act
            manager.DeleteAreaUsingAreaPath(GetRandomGuid());

            // assert
        }
Exemplo n.º 5
0
        public void ListAreas_passingInProjectDetails_InstanceOfListOfAreas()
        {
            // arrange
            ProjectDetail projectDetail = TestConstants.TfsTeamProjectDetail;
            IAreaManager  manager       = AreaManagerFactory.GetManager(projectDetail);

            // act
            List <ProjectArea> list = manager.ListAreas();

            // assert
            Assert.IsInstanceOfType(list, typeof(List <ProjectArea>));
        }
Exemplo n.º 6
0
        public void AddArea_passingInProjectDetailsWithThreeLevelsOfAreas_AreaCountStaysTheSameButTheChildOfChildAreaCountOfTheFirstAreaGoesUpByOne()
        {
            // arrange
            ProjectDetail      projectDetail = TestConstants.TfsTeamProjectDetail;
            List <ProjectArea> initialList;
            ProjectArea        initialFirstArea;
            List <ProjectArea> finalList;
            ProjectArea        finalFirstArea;

            using (IAreaManager manager = AreaManagerFactory.GetManager(projectDetail))
            {
                initialList = manager.ListAreas();
                if (initialList.Count == 0)
                {
                    Assert.Fail("No Areas found yet to add a duplication of");
                }
                ProjectArea[] listOfAreas = initialList.Where(o => o.Children.Count > 0).ToArray();
                if (listOfAreas.Length == 0)
                {
                    Assert.Fail("No Areas found in the first interation yet to add a duplication of");
                }
                listOfAreas = listOfAreas.Where(o => o.Children.Count > 0).ToArray();
                if (listOfAreas.Length == 0)
                {
                    Assert.Fail("The first interation has no children yet to add a duplication of");
                }
                ProjectArea firstArea = listOfAreas[0];
                initialFirstArea = firstArea.Children[0];
                string newAreaName = firstArea.Name + "\\" + initialFirstArea.Name + "\\Area " + GetRandomGuid();

                // act
                manager.AddNewArea(newAreaName);

                // assert
                finalList      = manager.ListAreas();
                listOfAreas    = finalList.Where(o => o.Children.Count > 0).ToArray();
                listOfAreas    = listOfAreas.Where(o => o.Children.Count > 0).ToArray();
                finalFirstArea = listOfAreas[0].Children[0];
            }

            int expectedRoot = initialList.Count;
            int actualRoot   = finalList.Count;

            // check root level Area count
            Assert.AreEqual(expectedRoot, actualRoot);

            int expectedChild = initialFirstArea.Children.Count + 1;
            int actualChild   = finalFirstArea.Children.Count;

            // check child level Area count
            Assert.AreEqual(expectedChild, actualChild);
        }
Exemplo n.º 7
0
        public void IsAreaPathVisibleForAreaPlanning_passingInWrongPath_ReturnFalse()
        {
            // arrange
            ProjectDetail projectDetail = TestConstants.TfsTeamProjectDetail;
            IAreaManager  manager       = AreaManagerFactory.GetManager(projectDetail);
            bool          actual        = false;

            // act
            actual = manager.IsAreaPathEnabled(TestConstants.TfsTeam, GetRandomGuid());

            // assert
            Assert.IsFalse(actual);
        }
Exemplo n.º 8
0
        public void AddArea_passingInProjectDetailsAndAnExistingAreaName_ExceptionThrown()
        {
            // arrange
            ProjectDetail projectDetail = TestConstants.TfsTeamProjectDetail;

            using (IAreaManager manager = AreaManagerFactory.GetManager(projectDetail))
            {
                string newAreaName = GetRandomGuid() + " Area";
                manager.AddNewArea(newAreaName);

                // act
                manager.AddNewArea(newAreaName);
            }
        }
Exemplo n.º 9
0
        public void EnableDisableAreaPath_passingInNewPath_ShouldEnablePathAndThenDisablePath()
        {
            // arrange
            ProjectDetail projectDetail = TestConstants.TfsTeamProjectDetail;
            IAreaManager  manager       = AreaManagerFactory.GetManager(projectDetail);
            string        newAreaName   = GetRandomGuid();

            manager.AddNewArea(newAreaName);

            manager.EnableAreaPath(TestConstants.TfsTeam, newAreaName, true);
            Assert.IsTrue(manager.IsAreaPathEnabled(TestConstants.TfsTeam, newAreaName), "Area path did not enable for team.");
            manager.DisableAreaPath(TestConstants.TfsTeam, newAreaName);
            Assert.IsFalse(manager.IsAreaPathEnabled(TestConstants.TfsTeam, newAreaName), "Area path did not disable for team.");
        }
Exemplo n.º 10
0
        public void Ctor_disposeOfObject_NoErrorThrown()
        {
            // arrange
            ProjectDetail projectDetail = TestConstants.TfsTeamProjectDetail;

            // act
            using (IAreaManager manager = AreaManagerFactory.GetManager(projectDetail))
            {
                manager.Dispose();
            }

            // assert
            Assert.IsTrue(1 == 1);
        }
Exemplo n.º 11
0
        public void IsAreaPathVisibleForAreaPlanning_passingInCorrectPath_ReturnTrue()
        {
            // arrange
            ProjectDetail projectDetail = TestConstants.TfsTeamProjectDetail;
            IAreaManager  manager       = AreaManagerFactory.GetManager(projectDetail);
            string        newAreaName   = GetRandomGuid();

            manager.AddNewArea(newAreaName);
            bool actual = false;

            // act
            actual = manager.IsAreaPathEnabled(TestConstants.TfsTeam, newAreaName);

            // assert
            Assert.IsFalse(actual);
        }
Exemplo n.º 12
0
        public void DeleteAreaUsingAreaPath_passInAValidAreaPath_ListAreasReturnLess1ThanBeforeDelele()
        {
            // arrange
            ProjectDetail projectDetail = TestConstants.TfsTeamProjectDetail;
            IAreaManager  manager       = AreaManagerFactory.GetManager(projectDetail);
            string        AreaPath;
            int           expected = this.AddArea(manager, out AreaPath);

            // act
            manager.DeleteAreaUsingAreaPath(AreaPath);

            // assert
            int actual = manager.ListAreas().Count;

            Assert.AreEqual(expected, actual);
        }
Exemplo n.º 13
0
        public void AddArea_passingInProjectDetails_AreaCountGoesUpByOne()
        {
            // arrange
            ProjectDetail      projectDetail = TestConstants.TfsTeamProjectDetail;
            List <ProjectArea> initialList;
            List <ProjectArea> finalList;
            IAreaManager       manager = AreaManagerFactory.GetManager(projectDetail);

            initialList = manager.ListAreas();
            string newAreaName = "Area " + GetRandomGuid();

            // act
            manager.AddNewArea(newAreaName);

            // assert
            finalList = manager.ListAreas();

            int expected = initialList.Count + 1;
            int actual   = finalList.Count;

            Assert.AreEqual(expected, actual);

            manager.Dispose();
        }