public void GetCurrentUserStories() { if (!this.Project.DataTypeReferences.Contains(this.UserStoryListRef)) { throw new BuildException(String.Format("The refid userstorylistref {0} is not defined.", this.UserStoryListRef)); } StringList RefStringList = (StringList)this.Project.DataTypeReferences[this.UserStoryListRef]; ServicesCF.ConnectionInformation = this.ConnectionInformation; IterationService iterationService = ServicesCF.GetService <IterationService>(); IterationDTO[] iterations = iterationService.RetrieveAll(); List <IterationDTO> currentIterationList = iterations.Where(iteration => iteration.ParentProjectID == this.ProjectId && iteration.StartDate <= DateTime.Today && iteration.EndDate >= DateTime.Today).ToList <IterationDTO>(); if (currentIterationList.Count == 0) { throw new BuildException("Could not find the current iteration.", this.Location); } IterationDTO currentIteration = currentIterationList[0]; UserStoryDTO[] userStories = iterationService.RetrieveUserStoriesForIteration(currentIteration.IterationID.Value); foreach (UserStoryDTO userStory in userStories) { string userStoryId = userStory.UserStoryID.ToString(); RefStringList.StringItems.Add(userStoryId, new StringItem(userStoryId)); } }
public void Setup() { this.iterationDaoService = new Mock <IIterationDao>(); this.iterationSetupService = new Mock <IIterationSetupService>(); this.transactionManager = new Mock <ICdp4TransactionManager>(); this.transactionManager.Setup(x => x.IsFullAccessEnabled()).Returns(true); this.iterationService = new IterationService { IterationDao = this.iterationDaoService.Object, IterationSetupService = this.iterationSetupService.Object, TransactionManager = this.transactionManager.Object }; }
public async Task GetIterationsAsync_WhenCalled_ReturnsAllIterations() { // Act IEnumerable <Iteration> iterations = null; using (var context = new OnlineShopContext(options)) { var sut = new IterationService(context); iterations = await sut.GetIterationsAsync(); } // Assert Assert.NotNull(iterations); Assert.Equal(3, iterations.Count()); }
private static IterationDTO GetCurrentIteration(int projectId, ConnectionInformation ConnectionInformation) { ServicesCF.ConnectionInformation = ConnectionInformation; IterationService iterationService = ServicesCF.GetService <IterationService>(); IterationDTO[] iterations = iterationService.RetrieveAll(); List <IterationDTO> currentIterationList = iterations.Where(iteration => iteration.ParentProjectID == projectId && iteration.StartDate <= DateTime.Today && iteration.EndDate >= DateTime.Today).ToList <IterationDTO>(); if (currentIterationList.Count == 0) { throw new BuildException("Could not find the current iteration."); } IterationDTO currentIteration = currentIterationList[0]; return(currentIteration); }
public void PerformWithThreads_ShouldPerformTheCorrectNumberOfIterations() { var builder = new StringBuilder(); var taskService = new IterationService(); taskService.PerformWithThreads(x => builder.Append($"{x}")); var result = builder.ToString(); var actual = new Regex(_threadRegexPattern).Matches(result); var matchedGroups = actual.Cast <Match>().GroupBy(x => x.Groups[1].Value).ToList(); Assert.AreEqual(_workersCount * _iterationsCount, actual.Count); Assert.AreEqual(_workersCount, matchedGroups.Count); matchedGroups.ForEach(x => { Assert.AreEqual(_iterationsCount, x.Count()); }); }