public async Task GetDetails_ShouldReturnViewModel() { var fixtures = new DetailsTestFixture(); var result = await fixtures.Sut.Details(fixtures.DetailsRequest); var viewResult = result.VerifyReturnsViewModel(); Assert.AreEqual(fixtures.ViewModel.Object, viewResult.Model); }
public async Task PostDetails_WithValidModel_ShouldSaveDraftApprenticeshipAndRedirectToCohortPage() { var fixtures = new DetailsTestFixture() .WithCohortWithEmployer() .WithCohort(); var result = await fixtures.Sut.EditDraftApprenticeship(new EditDraftApprenticeshipViewModel { AccountHashedId = fixtures.AccountHashedId, CohortId = fixtures.CohortId, CohortReference = fixtures.CohortReference, DraftApprenticeshipId = fixtures.DraftApprenticeshipId }); fixtures.CommitmentsApiClientMock.Verify(cs => cs.UpdateDraftApprenticeship(fixtures.CohortId, fixtures.DraftApprenticeshipId, It.IsAny <UpdateDraftApprenticeshipRequest>(), It.IsAny <CancellationToken>()), Times.Once); var redirect = result.VerifyReturnsRedirect(); }
public async Task GetDetails_Cohort_With_OtherParty_ShouldReturnViewPage() { var fixtures = new DetailsTestFixture() .WithCohortWithOtherParty(); var result = await fixtures.Sut.Details(fixtures.DetailsRequest); var viewResult = result.VerifyReturnsViewModel(); Assert.AreEqual("View", viewResult.ViewName); }
public async Task GetDetails_Cohort_With_Employer_ShouldReturnEditPage() { var fixtures = new DetailsTestFixture() .WithCohortWithEmployer(); var result = await fixtures.Sut.Details(fixtures.DetailsRequest); var viewResult = result.VerifyReturnsViewModel(); Assert.AreEqual("Edit", viewResult.ViewName); }