Esempio n. 1
0
        public async Task <BoxGraphData> 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 boxGraphHelper = new BoxGraphHelper();

            return(await boxGraphHelper.GetLeadTimeBoxGraphData(startDate, finishDate, product, engineering, unanticipated, assessmentsTeam, enterpriseTeam));
        }
        public async Task When_getting_lead_time_box_graph_data()
        {
            var mockTaskItemRepository = new Mock <ITaskItemRepository>();

            mockTaskItemRepository.Setup(x =>
                                         x.GetTaskItemListAsync(It.IsAny <DateTimeOffset>(), It.IsAny <DateTimeOffset>()))
            .ReturnsAsync(taskItemList);

            var boxGraphHelper = new BoxGraphHelper(mockTaskItemRepository.Object, new TaskItemHelper());
            var result         = await boxGraphHelper.GetLeadTimeBoxGraphData(
                new DateTimeOffset(new DateTime(2020, 10, 12), TimeSpan.Zero),
                new DateTimeOffset(new DateTime(2020, 10, 24), TimeSpan.Zero),
                true, true, true, true, true);

            Assert.IsNotNull(result);
            Assert.That(result.Entries.Count, Is.EqualTo(4));
            Assert.That(result.Entries[0].Minimum, Is.EqualTo(8m));
            Assert.That(result.Entries[0].LowerQuartile, Is.EqualTo(16m));
            Assert.That(result.Entries[0].Median, Is.EqualTo(24m));
            Assert.That(result.Entries[0].UpperQuartile, Is.EqualTo(32m));
            Assert.That(result.Entries[0].Maximum, Is.EqualTo(40m));
            Assert.That(result.Entries[0].TaskItemType, Is.EqualTo("Product"));

            Assert.That(result.Entries[1].Minimum, Is.EqualTo(8m));
            Assert.That(result.Entries[1].LowerQuartile, Is.EqualTo(16m));
            Assert.That(result.Entries[1].Median, Is.EqualTo(16m));
            Assert.That(result.Entries[1].UpperQuartile, Is.EqualTo(32m));
            Assert.That(result.Entries[1].Maximum, Is.EqualTo(40m));
            Assert.That(result.Entries[1].TaskItemType, Is.EqualTo("Engineering"));

            Assert.That(result.Entries[2].Minimum, Is.EqualTo(8m));
            Assert.That(result.Entries[2].LowerQuartile, Is.EqualTo(8m));
            Assert.That(result.Entries[2].Median, Is.EqualTo(24m));
            Assert.That(result.Entries[2].UpperQuartile, Is.EqualTo(40m));
            Assert.That(result.Entries[2].Maximum, Is.EqualTo(40m));
            Assert.That(result.Entries[2].TaskItemType, Is.EqualTo("Unanticipated"));

            Assert.That(result.Entries[3].Minimum, Is.EqualTo(8m));
            Assert.That(result.Entries[3].LowerQuartile, Is.EqualTo(8m));
            Assert.That(result.Entries[3].Median, Is.EqualTo(24m));
            Assert.That(result.Entries[3].UpperQuartile, Is.EqualTo(40m));
            Assert.That(result.Entries[3].Maximum, Is.EqualTo(40m));
            Assert.That(result.Entries[3].TaskItemType, Is.EqualTo("Selected Task Items"));

            Assert.That(result.Outliers.Count, Is.EqualTo(2));
            Assert.That(result.Outliers[0], Is.EqualTo(new object[] { 2, 96m }));
            Assert.That(result.Outliers[1], Is.EqualTo(new object[] { 3, 96m }));
        }