public void When_Perform_Post_Request_To_EditPostSecondaryInstitution_Return_Error_Response() { // Arrange const string error = "error"; var editPostSecondaryInstitutionModel = new EditPostSecondaryInstitutionModel { City = "city" }; var apiResult = new OdsApiResult { ErrorMessage = error }; _mockMapper.Setup(x => x.Map <PostSecondaryInstitution>(It.IsAny <EditPostSecondaryInstitutionModel>())) .Returns(new PostSecondaryInstitution()); _mockOdsApiFacade.Setup(x => x.EditPostSecondaryInstitution(It.IsAny <PostSecondaryInstitution>())) .Returns(apiResult); _mockOdsApiFacadeFactory.Setup(x => x.Create()) .Returns(Task.FromResult(_mockOdsApiFacade.Object)); _controller = new EducationOrganizationsController(_mockOdsApiFacadeFactory.Object, _mockMapper.Object, _mockInstanceContext.Object, _tabDisplayService.Object, _inferExtensionDetails); // Act var result = _controller.EditPostSecondaryInstitution(editPostSecondaryInstitutionModel).Result as ContentResult; // Assert result.ShouldNotBeNull(); result.Content.ShouldContain(error); }
public async Task <ActionResult> EditPostSecondaryInstitution(EditPostSecondaryInstitutionModel model) { var editResult = (await _odsApiFacadeFactory.Create()).EditPostSecondaryInstitution(_mapper.Map <PostSecondaryInstitution>(model)); return(editResult.Success ? JsonSuccess("Post-Secondary Institution Updated") : JsonError(editResult.ErrorMessage)); }