public void Then_the_start_date_is_updated() { var newStartDate = _fixture.Create <DateTime>(); _sut.SetStartDate(newStartDate); _sutModel.StartDate.Should().Be(newStartDate); }
public async Task Then_earnings_with_sent_payments_are_clawed_back_when_the_collection_period_has_changed() { // arrange await _sut.CalculateEarnings(_mockPaymentProfilesService.Object, _mockCollectionCalendarService.Object); byte collectionPeriod = 6; short collectionYear = 2020; var pendingPayment = _sutModel.PendingPaymentModels.Single(x => x.EarningType == EarningType.FirstPayment); pendingPayment.PendingPaymentValidationResultModels = new List <PendingPaymentValidationResultModel>(); pendingPayment.PendingPaymentValidationResultModels.Add(_fixture.Build <PendingPaymentValidationResultModel>().With(x => x.CollectionPeriod, new CollectionPeriod(collectionPeriod, collectionYear)).With(x => x.Result, true).Create()); _sut.CreatePayment(pendingPayment.Id, collectionPeriod, collectionPeriod); _sutModel.PaymentModels.First().PaidDate = DateTime.Now; _collectionPeriods.Add(new CollectionPeriod(4, (byte)_collectionPeriod.AddMonths(3).Month, (short)_collectionPeriod.AddMonths(3).Year, _collectionPeriod.AddMonths(3).AddDays(1), _fixture.Create <DateTime>(), _fixture.Create <short>(), true)); // act _sut.SetStartDate(_plannedStartDate.AddMonths(1)); await _sut.CalculateEarnings(_mockPaymentProfilesService.Object, _mockCollectionCalendarService.Object); // assert pendingPayment.ClawedBack.Should().BeTrue(); _sutModel.PendingPaymentModels.Count(x => x.EarningType == EarningType.FirstPayment).Should().Be(2); }