コード例 #1
0
        private AverageIncomeCalculator GetSut()
        {
            var startDateGetter  = new StartDateFromEndDateGetter();
            var payPeriodCreator = new FullPayPeriodCreator();
            var fullRoeCreator   = new FullRoeCreator(startDateGetter, payPeriodCreator);

            var mainStartDateGetter = new MainStartDateGetter();
            var incomeRoeGetter     = new IncomeRoeGetter();
            var weeklyIncomeGetter  = new WeeklyIncomeGetter(incomeRoeGetter);
            var incomeListGetter    = new IncomeListGetter(mainStartDateGetter, weeklyIncomeGetter);

            var result = new AverageIncomeCalculator(fullRoeCreator, incomeListGetter);

            return(result);
        }
コード例 #2
0
        public void ShouldWorkForPPEndMidWeek()
        {
            // Arrange
            var startOfWeek = new DateTime(2021, 7, 11);
            var minDate     = new DateTime(2021, 1, 1);
            var maxDate     = new DateTime(2021, 12, 31);

            var payPeriod = new FullPayPeriod(1, 100)
            {
                StartDate = new DateTime(2021, 7, 1),
                EndDate   = new DateTime(2021, 7, 15)
            };

            var sut = new IncomeRoeGetter();

            // Act
            var result = sut.Get(payPeriod, startOfWeek, minDate, maxDate);

            // Assert
            var expected = 500;

            Assert.Equal(expected, result);
        }