public async Task Application_Is_Created() { await _handler.Handle(_command, CancellationToken.None); var createdApplication = (CreateApplicationRequestData)_createApplicationRequest.Data; Assert.AreEqual(_command.PledgeId, _createApplicationRequest.PledgeId); Assert.AreEqual(_command.EmployerAccountId, createdApplication.EmployerAccountId); Assert.AreEqual(_command.Details, createdApplication.Details); Assert.AreEqual(_command.StandardId, createdApplication.StandardId); Assert.AreEqual(_getStandardResponse.Title, createdApplication.StandardTitle); Assert.AreEqual(_getStandardResponse.Level, createdApplication.StandardLevel); Assert.AreEqual(_getStandardResponse.TypicalDuration, createdApplication.StandardDuration); Assert.AreEqual(_getStandardResponse.Route, createdApplication.StandardRoute); Assert.AreEqual(_getStandardResponse.MaxFundingOn(_command.StartDate), createdApplication.StandardMaxFunding); Assert.AreEqual(_command.NumberOfApprentices, createdApplication.NumberOfApprentices); Assert.AreEqual(_command.StartDate, createdApplication.StartDate); Assert.AreEqual(_command.HasTrainingProvider, createdApplication.HasTrainingProvider); CollectionAssert.AreEqual(_command.Sectors, createdApplication.Sectors); CollectionAssert.AreEqual(_command.Locations, createdApplication.Locations); Assert.AreEqual(_command.AdditionalLocation, createdApplication.AdditionalLocation); Assert.AreEqual(_command.SpecificLocation, createdApplication.SpecificLocation); Assert.AreEqual(_command.FirstName, createdApplication.FirstName); Assert.AreEqual(_command.LastName, createdApplication.LastName); CollectionAssert.AreEqual(_command.EmailAddresses, createdApplication.EmailAddresses); Assert.AreEqual(_command.BusinessWebsite, createdApplication.BusinessWebsite); Assert.AreEqual(_command.UserId, createdApplication.UserId); Assert.AreEqual(_command.UserDisplayName, createdApplication.UserDisplayName); }
public async Task Then_The_CommitmentService_Is_Called_To_Get_Apprenticeship_Details( long accountId, long accountLegalEntityId, long[] apprenticeshipIds, Guid applicationId, [Frozen] Mock <ICommitmentsService> commitmentsService, CreateApplicationCommandHandler handler) { var command = new CreateApplicationCommand(applicationId, accountId, accountLegalEntityId, apprenticeshipIds); await handler.Handle(command, CancellationToken.None); commitmentsService.Verify(x => x.GetApprenticeshipDetails(command.AccountId, command.ApprenticeshipIds), Times.Once); }
public async Task Then_The_EmployerIncentivesService_Is_Called_To_Create_The_Initial_Application( long accountId, long accountLegalEntityId, long[] apprenticeshipIds, Guid applicationId, ApprenticeshipResponse[] apprenticeshipDetails, [Frozen] Mock <IApplicationService> applicationService, [Frozen] Mock <ICommitmentsService> commitmentsService, CreateApplicationCommandHandler handler) { var command = new CreateApplicationCommand(applicationId, accountId, accountLegalEntityId, apprenticeshipIds); commitmentsService.Setup(x => x.GetApprenticeshipDetails(command.AccountId, command.ApprenticeshipIds)) .ReturnsAsync(apprenticeshipDetails); await handler.Handle(command, CancellationToken.None); applicationService.Verify( x => x.Create( It.Is <CreateIncentiveApplicationRequestData>(p => p.IncentiveApplicationId == command.ApplicationId && p.AccountId == command.AccountId && p.AccountLegalEntityId == command.AccountLegalEntityId && p.Apprenticeships.Length == apprenticeshipDetails.Length)), Times.Once); }
public async Task CreateApplicationCommandHandler_Handel_ShouldThrowArgumentNullExceptionIfCommandIsNull() { await Assert.ThrowsAsync <ArgumentNullException>(() => _createApplicationCommandHandler.Handle(null, CancellationToken.None)); }