public void When_Perform_Post_Request_To_DeleteLocalEducationAgency_Return_Error_Response()
        {
            // Arrange
            var error = "error";
            var deleteLocalEducationAgencyModel = new DeleteEducationOrganizationModel
            {
                Id = "id"
            };
            var apiResult = new OdsApiResult {
                ErrorMessage = error
            };

            _mockOdsApiFacade.Setup(x => x.DeleteLocalEducationAgency(It.IsAny <string>()))
            .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.DeleteLocalEducationAgency(deleteLocalEducationAgencyModel).Result as ContentResult;

            // Assert
            result.ShouldNotBeNull();
            result.Content.ShouldContain(error);
        }
Пример #2
0
        public void When_Perform_Post_Request_To_DeleteLocalEducationAgency_Return_Success_Response()
        {
            // Arrange
            var deleteLocalEducationAgencyModel = new DeleteEducationOrganizationModel
            {
                Id = "id"
            };

            _mockOdsApiFacade.Setup(x => x.DeleteLocalEducationAgency(It.IsAny <string>()))
            .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.DeleteLocalEducationAgency(deleteLocalEducationAgencyModel).Result as ContentResult;

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