public async Task Then_the_incentive_status_is_withdrawn_when_the_incentive_has_paid_earnings() { //Arrange var incentiveModel = _fixture.Build <ApprenticeshipIncentiveModel>() .With(p => p.PendingPaymentModels, new List <PendingPaymentModel>()) .With(p => p.PaymentModels, new List <PaymentModel>()) .With(p => p.ClawbackPaymentModels, new List <ClawbackPaymentModel>()) .Create(); var pendingPaymentModel = _fixture.Build <PendingPaymentModel>() .With(p => p.ApprenticeshipIncentiveId, incentiveModel.Id) .Create(); incentiveModel.PendingPaymentModels.Add(pendingPaymentModel); var paymentModel = _fixture.Build <PaymentModel>() .With(p => p.ApprenticeshipIncentiveId, incentiveModel.Id) .With(p => p.PendingPaymentId, pendingPaymentModel.Id) .With(p => p.PaidDate, DateTime.Today.AddDays(-1)) .Create(); incentiveModel.PaymentModels.Add(paymentModel); var incentive = new ApprenticeshipIncentiveFactory().GetExisting(incentiveModel.Id, incentiveModel); var command = new WithdrawCommand(incentive.Account.Id, incentive.Id); _mockIncentiveDomainRepository.Setup(x => x.FindByApprenticeshipId(command.IncentiveApplicationApprenticeshipId)).ReturnsAsync(incentive); // Act await _sut.Handle(command); // Assert incentive.GetModel().Status.Should().Be(IncentiveStatus.Withdrawn); }
public void Then_the_submittedByEmail_is_set() { // Arrange var submittedByEmail = _fixture.Create <string>(); // Act var incentive = new ApprenticeshipIncentiveFactory().CreateNew(_fixture.Create <Guid>(), _fixture.Create <Guid>(), _fixture.Create <ApprenticeshipIncentives.ValueTypes.Account>(), _fixture.Create <ApprenticeshipIncentives.ValueTypes.Apprenticeship>(), _fixture.Create <DateTime>(), _fixture.Create <DateTime>(), submittedByEmail); // Assert incentive.GetModel().SubmittedByEmail.Should().Be(submittedByEmail); }
public void Then_the_apprenticeshipId_is_set() { // Arrange var apprenticeshipId = _fixture.Create <Guid>(); // Act var incentive = new ApprenticeshipIncentiveFactory().CreateNew(_fixture.Create <Guid>(), apprenticeshipId, _fixture.Create <ApprenticeshipIncentives.ValueTypes.Account>(), _fixture.Create <ApprenticeshipIncentives.ValueTypes.Apprenticeship>(), _fixture.Create <DateTime>(), _fixture.Create <DateTime>(), _fixture.Create <string>()); // Assert incentive.GetModel().ApplicationApprenticeshipId.Should().Be(apprenticeshipId); }
public void Then_there_are_no_pending_payments() { // Arrange // Act var incentive = new ApprenticeshipIncentiveFactory().CreateNew(_fixture.Create <Guid>(), _fixture.Create <Guid>(), _fixture.Create <ApprenticeshipIncentives.ValueTypes.Account>(), _fixture.Create <ApprenticeshipIncentives.ValueTypes.Apprenticeship>(), _fixture.Create <DateTime>(), _fixture.Create <DateTime>(), _fixture.Create <string>()); // Assert incentive.PendingPayments.Count.Should().Be(0); incentive.GetModel().PendingPaymentModels.Count.Should().Be(0); }
public void Then_the_submittedDate_is_set() { // Arrange var submittedDate = _fixture.Create <DateTime>(); // Act var incentive = new ApprenticeshipIncentiveFactory().CreateNew(_fixture.Create <Guid>(), _fixture.Create <Guid>(), _fixture.Create <ApprenticeshipIncentives.ValueTypes.Account>(), _fixture.Create <ApprenticeshipIncentives.ValueTypes.Apprenticeship>(), _fixture.Create <DateTime>(), submittedDate, _fixture.Create <string>(), new AgreementVersion(_fixture.Create <int>()), new IncentivePhase(Phase.Phase1)); // Assert incentive.GetModel().SubmittedDate.Should().Be(submittedDate); }
public void Then_the_phase_is_set(Phase phase) { // Arrange var incentivePhase = new IncentivePhase(phase); // Act var incentive = new ApprenticeshipIncentiveFactory().CreateNew(_fixture.Create <Guid>(), _fixture.Create <Guid>(), _fixture.Create <ApprenticeshipIncentives.ValueTypes.Account>(), _fixture.Create <ApprenticeshipIncentives.ValueTypes.Apprenticeship>(), _fixture.Create <DateTime>(), _fixture.Create <DateTime>(), _fixture.Create <string>(), new AgreementVersion(_fixture.Create <int>()), incentivePhase); // Assert incentive.GetModel().Phase.Identifier.Should().Be(phase); }
public void Then_the_startDate_is_set() { // Arrange var plannedStartDate = _fixture.Create <DateTime>(); // Act var incentive = new ApprenticeshipIncentiveFactory().CreateNew(_fixture.Create <Guid>(), _fixture.Create <Guid>(), _fixture.Create <ApprenticeshipIncentives.ValueTypes.Account>(), _fixture.Create <ApprenticeshipIncentives.ValueTypes.Apprenticeship>(), plannedStartDate, _fixture.Create <DateTime>(), _fixture.Create <string>()); // Assert incentive.StartDate.Should().Be(plannedStartDate); incentive.GetModel().StartDate.Should().Be(plannedStartDate); }
public void Then_the_account_is_set() { // Arrange var account = _fixture.Create <ApprenticeshipIncentives.ValueTypes.Account>(); // Act var incentive = new ApprenticeshipIncentiveFactory().CreateNew(_fixture.Create <Guid>(), _fixture.Create <Guid>(), account, _fixture.Create <ApprenticeshipIncentives.ValueTypes.Apprenticeship>(), _fixture.Create <DateTime>(), _fixture.Create <DateTime>(), _fixture.Create <string>(), new AgreementVersion(_fixture.Create <int>()), new IncentivePhase(Phase.Phase1)); // Assert incentive.Account.Should().Be(account); incentive.GetModel().Account.Id.Should().Be(account.Id); }