public void ShouldNotValidateAddSchoolModelIfGradeLevelsListIsEmpty() { // Arrange _addSchoolModel.GradeLevels = new List <string>(); var existingLeaWithDifferentId = new LocalEducationAgency { EducationOrganizationId = 2 }; _mockOdsApiFacade.Setup(x => x.GetAllLocalEducationAgencies()).Returns(new List <LocalEducationAgency> { existingLeaWithDifferentId }); var existingSchoolWithDifferentId = new School { EducationOrganizationId = 3 }; _mockOdsApiFacade.Setup(x => x.GetAllSchools()).Returns(new List <School> { existingSchoolWithDifferentId }); _mockOdsApiFacadeFactory.Setup(x => x.Create()) .Returns(Task.FromResult(_mockOdsApiFacade.Object)); var validator = new AddSchoolModelValidator(_mockOdsApiFacadeFactory.Object); validator.ShouldNotValidate(_addSchoolModel, "You must choose at least one grade level"); }
public void ShouldNotValidateAddSchoolModelIfSchoolIdIsEmpty() { _addSchoolModel.SchoolId = null; var validator = new AddSchoolModelValidator(_mockOdsApiFacadeFactory.Object); validator.ShouldNotValidate(_addSchoolModel, "'School ID' must not be empty."); }
public void ShouldNotValidateAddSchoolModelIfPassedWithExistingSchoolEdOrgId() { // Arrange var existingLeaWithDifferentId = new LocalEducationAgency { EducationOrganizationId = 2 }; _mockOdsApiFacade.Setup(x => x.GetAllLocalEducationAgencies()).Returns(new List <LocalEducationAgency> { existingLeaWithDifferentId }); var existingSchoolWithSameId = new School { EducationOrganizationId = Id }; _mockOdsApiFacade.Setup(x => x.GetAllSchools()).Returns(new List <School> { existingSchoolWithSameId }); _mockOdsApiFacadeFactory.Setup(x => x.Create()) .Returns(Task.FromResult(_mockOdsApiFacade.Object)); var validator = new AddSchoolModelValidator(_mockOdsApiFacadeFactory.Object); validator.ShouldNotValidate(_addSchoolModel, "This 'School ID' is already associated with another Education Organization. Please provide a unique value."); }
public void ShouldNotValidateAddSchoolModelIfSchoolIdIsEmpty() { _addSchoolModel.SchoolId = null; var validator = new AddSchoolModelValidator(); validator.ShouldNotValidate(_addSchoolModel, "'School ID' must not be empty."); }
public void ShouldNotValidateAddSchoolModelIfGradeLevelsListIsEmpty() { // Arrange _addSchoolModel.GradeLevels = new List <string>(); var existingLeaWithDifferentId = new LocalEducationAgency { EducationOrganizationId = 2 }; _mockOdsApiFacade.Setup(x => x.GetAllLocalEducationAgencies()).Returns(new List <LocalEducationAgency> { existingLeaWithDifferentId }); var existingSchoolWithDifferentId = new School { EducationOrganizationId = 3 }; _mockOdsApiFacade.Setup(x => x.GetAllSchools()).Returns(new List <School> { existingSchoolWithDifferentId }); var existingPsiWithDifferentId = new PostSecondaryInstitution { EducationOrganizationId = 4 }; _mockOdsApiFacade.Setup(x => x.GetAllPostSecondaryInstitutions()).Returns(new List <PostSecondaryInstitution> { existingPsiWithDifferentId }); var validator = new AddSchoolModelValidator(); validator.ShouldNotValidate(_addSchoolModel, "You must choose at least one grade level"); }