Esempio n. 1
0
        public async Task <QuarterWindow> GetQuarterWindow(Quarter quarter)
        {
            // Otherwise calculate submission window
            var quarterWindowTemplate = await dataAccess.GetByQuarter((int)quarter.Q);

            var startDate = new DateTime(quarter.Year + quarterWindowTemplate.AddStartYears, quarterWindowTemplate.StartMonth, quarterWindowTemplate.StartDay);
            var endDate   = new DateTime(quarter.Year + quarterWindowTemplate.AddEndYears, quarterWindowTemplate.EndMonth, quarterWindowTemplate.EndDay);

            return(new QuarterWindow(startDate, endDate, quarter.Q));
        }
        public async void GetQuarter_GivenFirstQuarter_ValidQuarterStartAndEndDatesShouldBeCalculated()
        {
            var quarter = new Quarter(2019, QuarterType.Q1);
            var quarterWindowTemplate = QuarterWindowTemplate(4, 1, 0, 1);

            A.CallTo(() => dataAccess.GetByQuarter((int)quarter.Q)).Returns(quarterWindowTemplate);

            var result = await quarterWindowFactory.GetAnnualQuarter(quarter);

            result.StartDate.Year.Should().Be(2019);
            result.StartDate.Month.Should().Be(1);
            result.StartDate.Day.Should().Be(1);
            result.EndDate.Year.Should().Be(2019);
            result.EndDate.Month.Should().Be(3);
            result.EndDate.Day.Should().Be(31);
        }