示例#1
0
        public void AddArea_passingInProjectDetailsWithThreeLevelsOfAreasAllCompletelyNew_AreaGoesUpByOneOnTopLevelAndTwoLevelsDownAreCreated()
        {
            // arrange
            ProjectDetail      projectDetail = TestConstants.TfsTeamProjectDetail;
            List <ProjectArea> initialList;
            List <ProjectArea> finalList;
            bool fullExpectedPathExists = false;

            using (IAreaManager manager = AreaManagerFactory.GetManager(projectDetail))
            {
                initialList = manager.ListAreas();
                string newAreaName = "Top Level " + GetRandomGuid() + "\\Level Two\\Level Three";

                // act
                manager.AddNewArea(newAreaName);

                // assert
                finalList = manager.ListAreas();

                fullExpectedPathExists = manager.CheckIfPathAlreadyExists(newAreaName);
            }

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

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

            // check newly added top level node has 1 child and that child has 1 child
            Assert.IsTrue(fullExpectedPathExists);
        }
示例#2
0
        public void AddArea_passingInProjectDetailsWithTwoLevelsOfAreas_AreaCountStaysTheSameButTheChildAreaCountOfTheFirstAreaGoesUpByOne()
        {
            // arrange
            ProjectDetail      projectDetail = TestConstants.TfsTeamProjectDetail;
            List <ProjectArea> initialList;
            ProjectArea        initialFirstArea;
            List <ProjectArea> finalList;
            ProjectArea        finalFirstArea;

            using (IAreaManager manager = AreaManagerFactory.GetManager(projectDetail))
            {
                initialList      = manager.ListAreas();
                initialFirstArea = initialList[0];
                string newAreaName = initialFirstArea.Name + "\\Area " + GetRandomGuid();

                // act
                manager.AddNewArea(newAreaName);

                // assert
                finalList      = manager.ListAreas();
                finalFirstArea = finalList[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);
        }
示例#3
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)));
        }
示例#4
0
        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));
        }
示例#5
0
 public ListHelper(IAreaManager areaManager, IGoalManager goalManager, IMetricManager metricManager, IExternalApiAuthManager externalApiAuthManager)
 {
     _areaManager            = areaManager;
     _goalManager            = goalManager;
     _metricManager          = metricManager;
     _externalApiAuthManager = externalApiAuthManager;
 }
示例#6
0
        public void DeleteArea_passInNull_ArgumentNullException()
        {
            // arrange
            ProjectDetail projectDetail = TestConstants.TfsTeamProjectDetail;
            IAreaManager  manager       = AreaManagerFactory.GetManager(projectDetail);

            // act
            manager.DeleteArea(null);

            // assert
        }
示例#7
0
        public void Ctor_passingInProjectDetails_InstanceOfAreaManager()
        {
            // arrange
            ProjectDetail projectDetail = TestConstants.TfsTeamProjectDetail;

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

            // assert
            Assert.IsInstanceOfType(manager, typeof(IAreaManager));
        }
示例#8
0
        private int AddArea(IAreaManager manager, out string areaPath)
        {
            int notExpected = manager.ListAreas().Count;

            areaPath = GetRandomGuid();
            manager.AddNewArea(areaPath);
            int actual = manager.ListAreas().Count;

            Assert.AreNotEqual(notExpected, actual, "Adding an Area to delete returned unexpected count");
            return(notExpected);
        }
示例#9
0
        public void DeleteAreaUsingAreaPath_passInAInValidAreaPath_ExceptionExpected()
        {
            // arrange
            ProjectDetail projectDetail = TestConstants.TfsTeamProjectDetail;
            IAreaManager  manager       = AreaManagerFactory.GetManager(projectDetail);

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

            // assert
        }
示例#10
0
 public AccountController(IUserManager userManager,
                          IMobileManager mobileManager,
                          IClassesManager classesManager,
                          ITradeManager tradeManager,
                          IAreaManager areaManager)
 {
     _UserManager    = userManager;
     _MobileManager  = mobileManager;
     _ClassesManager = classesManager;
     _TradeManager   = tradeManager;
     _AreaManager    = areaManager;
 }
示例#11
0
 public AccountController(IUserManager userManager,
     IMobileManager mobileManager,
     IClassesManager classesManager,
     ITradeManager tradeManager,
     IAreaManager areaManager)
 {
     _UserManager = userManager;
     _MobileManager = mobileManager;
     _ClassesManager = classesManager;
     _TradeManager = tradeManager;
     _AreaManager = areaManager;
 }
示例#12
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>));
        }
示例#13
0
 public AreaViewModel(IMessageBoxService messageBoxService, Area area, IAreaManager manager) : base(messageBoxService, area, manager)
 {
     // do initialization
     try
     {
         this.DisplayName = "Edit Area: " + this.Item.Name;
     }
     catch (Exception ex)
     {
         this.MessageBoxService.ShowError(this.GetType().FullName + System.Reflection.MethodBase.GetCurrentMethod().Name + ": " + ex.Message);
     }
 }
示例#14
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);
        }
示例#15
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);
        }
示例#16
0
        public FootballImportService(IFootballImporter footballImporter,
                                     IAreaManager areaManager,
                                     ILeagueManager leagueManager,
                                     ITeamManager teamManager,
                                     IMatchManager matchManager)
        {
            _footballImporter = footballImporter;

            _areaManager   = areaManager;
            _leagueManager = leagueManager;
            _teamManager   = teamManager;
            _matchManager  = matchManager;
        }
示例#17
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.");
        }
示例#18
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);
        }
示例#19
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);
            }
        }
示例#20
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);
        }
示例#21
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);
        }
示例#22
0
 public ReportsController(IReportManager reportManager, IMetricManager metricManager, IReportGoalManager reportGoalManager,
                          ICompanyManager companyManager, IReportAreaManager reportAreaManager, ListHelper listHelper,
                          IRecipientManager recipientManager, IReportEmailManager reportEmailManager, IAreaManager areaManager,
                          IReportAttachmentManager reportAttachmentManager, ISubscriptionManager subscriptionManager, IWebhookManager webhookManager)
 {
     _reportManager           = reportManager;
     _metricManager           = metricManager;
     _companyManager          = companyManager;
     ListHelper               = listHelper;
     _reportGoalManager       = reportGoalManager;
     _reportAreaManager       = reportAreaManager;
     _recipientManager        = recipientManager;
     _reportEmailManager      = reportEmailManager;
     _areaManager             = areaManager;
     _reportAttachmentManager = reportAttachmentManager;
     _subscriptionManager     = subscriptionManager;
     _webhookManager          = webhookManager;
 }
示例#23
0
        public TableViewModel(IMessageBoxService messageBoxService, Table table, ITableManager manager, IAreaManager areaManager) : base(messageBoxService, table, manager)
        {
            // do initialization
            try
            {
                if (areaManager == null)
                {
                    throw new ArgumentNullException("areaManager");
                }
                _areaManager = areaManager;
                // populate the list of areas
                this.AreaList = _areaManager.GetList();

                this.DisplayName = "Edit Table: " + this.Item.Name;
            }
            catch (Exception ex)
            {
                this.MessageBoxService.ShowError(this.GetType().FullName + System.Reflection.MethodBase.GetCurrentMethod().Name + ": " + ex.Message);
            }
        }
示例#24
0
        public TablesManagementViewModel(IMessageBoxService messageBoxService, IUIVisualizerService uiVisualizerService,
                                         ITableManager tableManager, IAreaManager areaManager) : base(messageBoxService, uiVisualizerService, tableManager)
        {
            // do initialization
            try
            {
                if (areaManager == null)
                {
                    throw new ArgumentNullException("areaManager");
                }
                _areaManager = areaManager;

                // get list
                this.DisplayName  = "Tables Management";
                this.Items        = new System.Collections.ObjectModel.ObservableCollection <Table>(GetItems());
                AreaListViewModel = new AreaListViewModel(this.MessageBoxService, this.UIVisualizerService, _areaManager);
            }
            catch (Exception ex)
            {
                this.MessageBoxService.ShowError(this.GetType().FullName + System.Reflection.MethodBase.GetCurrentMethod().Name + ": " + ex.Message);
            }
        }
示例#25
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();
        }
示例#26
0
 public ReportingAreasController(IAreaManager areaManager, ListHelper listHelper)
 {
     _areaManager = areaManager;
     ListHelper   = listHelper;
 }
示例#27
0
 public AreaController(IAreaManager areaManager)
 {
     _AreaManager = areaManager;
 }
示例#28
0
 public AreaController(IAreaManager areaManager, IValidatorFactory validatorFactory)
 {
     this.areaManager      = areaManager;
     this.validatorFactory = validatorFactory;
 }
示例#29
0
 public CommonDataController(IClassesManager classesManager, ITradeManager tradeManager, IAreaManager areaManager)
 {
     _ClassesManager = classesManager;
     _TradeManager   = tradeManager;
     _AreaManager    = areaManager;
 }
示例#30
0
 public EmployeeRegisterManager(IAreaManager areaManager,
                                IEmployeeManager employeeManager)
 {
     _areaManager     = areaManager;
     _employeeManager = employeeManager;
 }
示例#31
0
 public UserController(IUserManager userManager, IAreaManager areaManager, IClassesManager classManager)
 {
     _UserManager  = userManager;
     _AreaManager  = areaManager;
     _ClassManager = classManager;
 }
示例#32
0
 public AreasController(IAreaManager areaManager)
 {
     _areaManager = areaManager;
 }
示例#33
0
 public CommonDataController(IClassesManager classesManager,ITradeManager tradeManager,IAreaManager areaManager)
 {
     _ClassesManager = classesManager;
     _TradeManager = tradeManager;
     _AreaManager = areaManager;
 }
示例#34
0
        private int AddArea(IAreaManager manager, out string areaPath)
        {
            int notExpected = manager.ListAreas().Count;
            areaPath = GetRandomGuid();
            manager.AddNewArea(areaPath);
            int actual = manager.ListAreas().Count;

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