public async Task <ActionResult> ReviewChanges(long providerId, string hashedApprenticeshipId, ReviewApprenticeshipUpdateViewModel viewModel) { if (!ModelState.IsValid) { return(await ReviewChanges(providerId, hashedApprenticeshipId)); } await _orchestrator.SubmitReviewApprenticeshipUpdate(providerId, hashedApprenticeshipId, CurrentUserId, viewModel.ApproveChanges.Value, GetSignedInUser()); SetInfoMessage(viewModel.ApproveChanges.Value ? "Record updated" : "Changes rejected", FlashMessageSeverityLevel.Okay); return(RedirectToAction("Details", new { providerId, hashedApprenticeshipId })); }
public async Task ShouldCallMediatorToSubmitReview(bool isApproved) { //Arrange var providerId = 1; var apprenticeshipId = "appid"; var userId = "tester"; var loginUser = new SignInUserModel { DisplayName = "Bob", Email = "*****@*****.**" }; //Act await _orchestrator.SubmitReviewApprenticeshipUpdate(providerId, apprenticeshipId, userId, isApproved, loginUser); //Assert _mediator.Verify(x => x.Send( It.Is <ReviewApprenticeshipUpdateCommand>(r => r.IsApproved == isApproved && r.ProviderId == providerId && r.UserId == userId && r.UserDisplayName == loginUser.DisplayName && r.UserEmailAddress == loginUser.Email ), It.IsAny <CancellationToken>()), Times.Once()); }