public void When_Perform_Post_Request_To_EditLocalEducationAgency_Return_Error_Response()
        {
            // Arrange
            const string error = "error";
            var          editLocalEducationAgencyModel = new EditLocalEducationAgencyModel
            {
                City = "city"
            };

            var apiResult = new OdsApiResult {
                ErrorMessage = error
            };

            _mockMapper.Setup(x => x.Map <LocalEducationAgency>(It.IsAny <EditLocalEducationAgencyModel>()))
            .Returns(new LocalEducationAgency());
            _mockOdsApiFacade.Setup(x => x.EditLocalEducationAgency(It.IsAny <LocalEducationAgency>()))
            .Returns(apiResult);
            _mockOdsApiFacadeFactory.Setup(x => x.Create())
            .Returns(Task.FromResult(_mockOdsApiFacade.Object));
            _controller =
                new EducationOrganizationsController(_mockOdsApiFacadeFactory.Object, _mockMapper.Object, _mockInstanceContext.Object);

            // Act
            var result = _controller.EditLocalEducationAgency(editLocalEducationAgencyModel).Result as ContentResult;

            // Assert
            result.ShouldNotBeNull();
            result.Content.ShouldContain(error);
        }
Beispiel #2
0
        public void When_Perform_Post_Request_To_EditLocalEducationAgency_Return_Success_Response()
        {
            // Arrange
            var editLocalEducationAgencyModel = new EditLocalEducationAgencyModel
            {
                City = "city"
            };

            _mockMapper.Setup(x => x.Map <LocalEducationAgency>(It.IsAny <EditLocalEducationAgencyModel>()))
            .Returns(new LocalEducationAgency());
            _mockOdsApiFacade.Setup(x => x.EditLocalEducationAgency(It.IsAny <LocalEducationAgency>()))
            .Returns(new OdsApiResult());
            _mockOdsApiFacadeFactory.Setup(x => x.Create())
            .Returns(Task.FromResult(_mockOdsApiFacade.Object));
            _controller =
                new EducationOrganizationsController(_mockOdsApiFacadeFactory.Object, _mockMapper.Object, _mockInstanceContext.Object, _tabDisplayService.Object);

            // Act
            var result = _controller.EditLocalEducationAgency(editLocalEducationAgencyModel).Result as ContentResult;

            // Assert
            result.ShouldNotBeNull();
            result.Content.ShouldContain("Organization Updated");
        }