public void ShouldValidateAddPostSecondaryInstitutionModelWithValidValues() { // Arrange 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 AddPostSecondaryInstitutionModelValidator(); validator.ShouldValidate(_addPostSecondaryInstitutionModel); EducationOrganizationValidationHelper .ProposedEducationOrganizationIdIsInUse(_addPostSecondaryInstitutionModel.PostSecondaryInstitutionId.Value, _mockOdsApiFacade.Object) .ShouldBeFalse(); }
public void ShouldNotValidateAddLocalEducationAgencyModelIfPassedWithExistingLeaEdOrgId() { // Arrange var existingLeaWithSameId = new LocalEducationAgency { EducationOrganizationId = Id }; _mockOdsApiFacade.Setup(x => x.GetAllLocalEducationAgencies()).Returns(new List <LocalEducationAgency> { existingLeaWithSameId }); var existingSchoolWithDifferentId = new School { EducationOrganizationId = 2 }; _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 }); EducationOrganizationValidationHelper .ProposedEducationOrganizationIdIsInUse(_addLocalEducationAgencyModel.LocalEducationAgencyId.Value, _mockOdsApiFacade.Object) .ShouldBeTrue(); }