public async Task AboutToRejectOutcome_selection_No() { var applicationId = Guid.NewGuid(); var expectedActionName = "ConfirmOutcome"; var viewModel = new RoatpGatewayRejectedOutcomeViewModel { ApplicationId = applicationId, GatewayReviewStatus = GatewayReviewStatus.Rejected, GatewayReviewComment = "some comment", ConfirmGatewayOutcome = "No" }; var result = await _controller.AboutToRejectOutcome(viewModel); var redirectToActionResult = result as RedirectToActionResult; Assert.AreSame(expectedActionName, redirectToActionResult.ActionName); ApplyApiClient.Verify(x => x.UpdateGatewayReviewStatusAndComment(applicationId, viewModel.GatewayReviewStatus, viewModel.GatewayReviewComment, viewModel.GatewayReviewExternalComment, viewModel.SubcontractingLimit, UserId, Username), Times.Never); }
public async Task AboutToRejectOutcome_selection_Yes() { var applicationId = Guid.NewGuid(); var viewModel = new RoatpGatewayRejectedOutcomeViewModel { ApplicationId = applicationId, GatewayReviewStatus = GatewayReviewStatus.Rejected, GatewayReviewComment = "some comment", ConfirmGatewayOutcome = "Yes" }; var result = await _controller.AboutToRejectOutcome(viewModel); var viewResult = result as ViewResult; var viewResultModel = viewResult.Model as RoatpGatewayOutcomeViewModel; Assert.AreSame(viewModel.GatewayReviewStatus, viewResultModel.GatewayReviewStatus); ApplyApiClient.Verify(x => x.UpdateGatewayReviewStatusAndComment(applicationId, viewModel.GatewayReviewStatus, viewModel.GatewayReviewComment, viewModel.GatewayReviewExternalComment, viewModel.SubcontractingLimit, UserId, Username), Times.Once); }
public async Task AboutToRejectOutcome_no_selection() { var applicationId = Guid.NewGuid(); var viewModel = new RoatpGatewayRejectedOutcomeViewModel { ApplicationId = applicationId, GatewayReviewStatus = GatewayReviewStatus.Rejected, GatewayReviewComment = "some comment" }; _controller.ModelState.AddModelError("ConfirmGatewayOutcome", "Select if you are sure you want to reject this application"); var result = await _controller.AboutToRejectOutcome(viewModel); var viewResult = result as ViewResult; var resultViewModel = viewResult.Model as RoatpGatewayRejectedOutcomeViewModel; Assert.AreSame(HtmlAndCssElements.CssFormGroupErrorClass, resultViewModel.CssFormGroupError); ApplyApiClient.Verify(x => x.UpdateGatewayReviewStatusAndComment(applicationId, viewModel.GatewayReviewStatus, viewModel.GatewayReviewComment, viewModel.GatewayReviewExternalComment, viewModel.SubcontractingLimit, UserId, Username), Times.Never); }