public async Task Then_The_Signed_Agreements_Are_Returned( GetBankingDataQuery query, IncentiveApplicationDto applicationResponse, LegalEntity legalEntityResponse, [Frozen] Mock <IApplicationService> applicationService, [Frozen] Mock <IAccountsService> accountsService, GetBankingDataHandler handler ) { applicationService.Setup(x => x.Get(query.AccountId, query.ApplicationId)).ReturnsAsync(applicationResponse); accountsService.Setup(x => x.GetLegalEntity(query.HashedAccountId, applicationResponse.LegalEntityId)).ReturnsAsync(legalEntityResponse); var actual = await handler.Handle(query, CancellationToken.None); actual.Data.SignedAgreements.Should().BeEquivalentTo(legalEntityResponse.Agreements.Where(x => x.Status == EmployerAgreementStatus.Signed || x.Status == EmployerAgreementStatus.Expired || x.Status == EmployerAgreementStatus.Superseded), opts => opts.ExcludingMissingMembers()); }
public async Task Then_The_Application_Data_Is_Returned( GetBankingDataQuery query, IncentiveApplicationDto applicationResponse, [Frozen] Mock <IApplicationService> applicationService, GetBankingDataHandler handler ) { applicationService.Setup(x => x.Get(query.AccountId, query.ApplicationId)).ReturnsAsync(applicationResponse); var actual = await handler.Handle(query, CancellationToken.None); actual.Data.SubmittedByEmail.Should().Be(applicationResponse.SubmittedByEmail); actual.Data.SubmittedByName.Should().Be(applicationResponse.SubmittedByName); actual.Data.LegalEntityId.Should().Be(applicationResponse.LegalEntityId); actual.Data.ApplicationValue.Should().Be(applicationResponse.Apprenticeships.Sum(x => x.TotalIncentiveAmount)); actual.Data.VendorCode.Should().Be("00000000"); actual.Data.NumberOfApprenticeships.Should().Be(applicationResponse.Apprenticeships.Count()); }
public async Task Then_Agreements_Without_a_Signed_Date_Are_Not_Returned( GetBankingDataQuery query, IncentiveApplicationDto applicationResponse, LegalEntity legalEntityResponse, [Frozen] Mock <IApplicationService> applicationService, [Frozen] Mock <IAccountsService> accountsService, GetBankingDataHandler handler ) { var agreementWithoutDate = legalEntityResponse.Agreements.First(x => x.Status == EmployerAgreementStatus.Signed || x.Status == EmployerAgreementStatus.Expired || x.Status == EmployerAgreementStatus.Superseded); agreementWithoutDate.SignedDate = null; applicationService.Setup(x => x.Get(query.AccountId, query.ApplicationId)).ReturnsAsync(applicationResponse); accountsService.Setup(x => x.GetLegalEntity(query.HashedAccountId, applicationResponse.LegalEntityId)).ReturnsAsync(legalEntityResponse); var actual = await handler.Handle(query, CancellationToken.None); actual.Data.SignedAgreements.Count().Should().Be(legalEntityResponse.Agreements.Count(x => x.Status == EmployerAgreementStatus.Signed || x.Status == EmployerAgreementStatus.Expired || x.Status == EmployerAgreementStatus.Superseded) - 1); }