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

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

            // Assert
            result.ShouldNotBeNull();
            result.Content.ShouldContain(error);
        }
        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);

            // Act
            var result = _controller.DeleteLocalEducationAgency(deleteLocalEducationAgencyModel).Result as ContentResult;

            // Assert
            result.ShouldNotBeNull();
            result.Content.ShouldContain("Organization Removed");
        }
示例#3
0
        public void When_Perform_Post_Request_To_DeletePostSecondaryInstitution_Return_Success_Response()
        {
            // Arrange
            var deletePostSecondaryInstitutionModel = new DeleteEducationOrganizationModel
            {
                Id = "id"
            };

            _mockOdsApiFacade.Setup(x => x.DeletePostSecondaryInstitution(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, _inferExtensionDetails);

            // Act
            var result = _controller.DeletePostSecondaryInstitution(deletePostSecondaryInstitutionModel).Result as ContentResult;

            // Assert
            result.ShouldNotBeNull();
            result.Content.ShouldContain("Post-Secondary Institution Removed");
        }
        public async Task <ActionResult> DeleteSchool(DeleteEducationOrganizationModel model)
        {
            var deletionResult = (await _odsApiFacadeFactory.Create()).DeleteSchool(model.Id);

            return(deletionResult.Success ? JsonSuccess("School Removed") : JsonError(deletionResult.ErrorMessage));
        }
        public async Task <ActionResult> DeletePostSecondaryInstitution(DeleteEducationOrganizationModel model)
        {
            var deletionResult = (await _odsApiFacadeFactory.Create()).DeletePostSecondaryInstitution(model.Id);

            return(deletionResult.Success ? JsonSuccess("Post-Secondary Institution Removed") : JsonError(deletionResult.ErrorMessage));
        }