public async Task <CumulativeFlowData> Get(string startDateString, string finishDateString, bool product, bool engineering, bool unanticipated, bool assessmentsTeam, bool enterpriseTeam) { var startDate = DateHelper.GetStartDate(startDateString); var finishDate = DateHelper.GetFinishDate(finishDateString); var cumulativeFlowDiagramHelper = new CumulativeFlowDiagramHelper(); var data = await cumulativeFlowDiagramHelper.GetCumulativeFlowDataAsync(startDate, finishDate, product, engineering, unanticipated, assessmentsTeam, enterpriseTeam); return(data); }
public async Task When_getting_cumulative_flow_data() { var mockTaskItemRepository = new Mock <TaskItemRepository>(); mockTaskItemRepository .Setup(x => x.GetTaskItemListAsync(It.IsAny <DateTimeOffset?>(), It.IsAny <DateTimeOffset?>())) .ReturnsAsync(taskItems); var mockHistoryEventRepository = new Mock <HistoryEventRepository>(); mockHistoryEventRepository.SetupSequence(x => x.GetHistoryEventsByTaskIdAsync(It.IsAny <int>())) .ReturnsAsync(taskItems[0].HistoryEvents) .ReturnsAsync(taskItems[1].HistoryEvents) .ReturnsAsync(taskItems[2].HistoryEvents) .ReturnsAsync(taskItems[3].HistoryEvents); var cumulativeFlowDiagramHelper = new CumulativeFlowDiagramHelper(mockTaskItemRepository.Object, mockHistoryEventRepository.Object); var result = await cumulativeFlowDiagramHelper.GetCumulativeFlowDataAsync( new DateTimeOffset(new DateTime(2021, 1, 11)), new DateTimeOffset(new DateTime(2021, 1, 17)), true, true, true, true, true); foreach (var res in result.data) { foreach (var datum in res.data) { Console.Write($"{datum}, "); } Console.Write("\n"); } Assert.That(result.data[0].data, Is.EqualTo(new List <int> { 1, 1, 0, 0, 0, 0, 0 })); Assert.That(result.data[1].data, Is.EqualTo(new List <int> { 0, 1, 1, 2, 1, 1, 0 })); Assert.That(result.data[2].data, Is.EqualTo(new List <int> { 0, 0, 1, 1, 1, 1, 1 })); Assert.That(result.data[3].data, Is.EqualTo(new List <int> { 0, 0, 0, 0, 1, 1, 2 })); }
public async Task When_getting_cumulative_flow_data_for_specific_development_teams() { var mockTaskItemRepository = new Mock <TaskItemRepository>(); mockTaskItemRepository .Setup(x => x.GetTaskItemListAsync(It.IsAny <DateTimeOffset?>(), It.IsAny <DateTimeOffset?>())) .ReturnsAsync(taskItems); var mockHistoryEventRepository = new Mock <HistoryEventRepository>(); mockHistoryEventRepository.SetupSequence(x => x.GetHistoryEventsByTaskIdAsync(It.IsAny <int>())) .ReturnsAsync(taskItems[0].HistoryEvents) .ReturnsAsync(taskItems[1].HistoryEvents) .ReturnsAsync(taskItems[2].HistoryEvents) .ReturnsAsync(taskItems[3].HistoryEvents); var cumulativeFlowDiagramHelper = new CumulativeFlowDiagramHelper(mockTaskItemRepository.Object, mockHistoryEventRepository.Object); var result = await cumulativeFlowDiagramHelper.GetCumulativeFlowDataAsync( new DateTimeOffset(new DateTime(2021, 1, 11)), new DateTimeOffset(new DateTime(2021, 1, 17)), true, false, false, true, true); Assert.That(result.data[0].data, Is.EqualTo(new List <int> { 1, 0, 0, 0, 0, 0, 0 })); Assert.That(result.data[1].data, Is.EqualTo(new List <int> { 0, 1, 0, 0, 0, 0, 0 })); Assert.That(result.data[2].data, Is.EqualTo(new List <int> { 0, 0, 1, 1, 0, 0, 0 })); Assert.That(result.data[3].data, Is.EqualTo(new List <int> { 0, 0, 0, 0, 1, 1, 1 })); }