public async Task Then_the_apprenticeships_being_applied_for_are_displayed_when_they_have_eligible_employer_start_dates() { // Arrange var legalEntityName = _fixture.Create <string>(); var apprenticeship1 = _fixture .Build <ApplicationApprenticeshipModel>() .With(a => a.StartDatesAreEligible, true) .Create(); var apprenticeship2 = _fixture .Build <ApplicationApprenticeshipModel>() .With(a => a.StartDatesAreEligible, true) .Create(); var apprentices = new List <ApplicationApprenticeshipModel> { apprenticeship1, apprenticeship2 }; var applicationResponse = new ApplicationModel( _applicationId, _accountId, _accountLegalEntityId, apprentices, false, false); _mockApplicationService .Setup(m => m.Get(_accountId, _applicationId, true, false)) .ReturnsAsync(applicationResponse); _mockLegalEntitiesService .Setup(m => m.Get(_accountId, _accountLegalEntityId)) .ReturnsAsync(new LegalEntityModel() { Name = legalEntityName }); // Act var viewResult = await _sut.ConfirmApprenticeships(_accountId, _applicationId) as ViewResult; // Assert viewResult.Should().NotBeNull(); var model = viewResult.Model as ApplicationConfirmationViewModel; model.Should().NotBeNull(); model.AccountId.Should().Be(_accountId); model.AccountLegalEntityId.Should().Be(_accountLegalEntityId); model.OrganisationName.Should().Be(legalEntityName); model.Apprentices.Count.Should().Be(2); AssertAreEquivalent(model.Apprentices.Single(a => a.ApprenticeshipId == apprenticeship1.ApprenticeshipId), apprenticeship1); AssertAreEquivalent(model.Apprentices.Single(a => a.ApprenticeshipId == apprenticeship2.ApprenticeshipId), apprenticeship2); }
public async Task Then_the_employment_start_dates_are_submitted() { // Arrange var apprentices = _fixture.Build <ApplicationApprenticeshipModel>() .With(a => a.StartDatesAreEligible, true).CreateMany(3).ToList(); apprentices[0].StartDatesAreEligible = false; var application = new ApplicationModel(Guid.NewGuid(), _fixture.Create <string>(), _fixture.Create <string>(), apprentices, _fixture.Create <bool>(), _fixture.Create <bool>()); _applicationServiceMock.Setup(x => x.Get(_hashedAccountId, _applicationId, true, false)).ReturnsAsync(application); // Act var result = await _sut.ConfirmApprenticeships(_hashedAccountId, _applicationId, false) as ViewResult; // Assert Assert.IsNotNull(result); var model = result.Model as ApplicationConfirmationViewModel; Assert.IsNotNull(model); model.Apprentices.Count.Should().Be(2); model.Apprentices.Any(a => !a.StartDatesAreEligible).Should().BeFalse(); _applicationServiceMock.Verify(x => x.Get(_hashedAccountId, _applicationId, true, false), Times.Once()); }