public void ShouldValidateAddSchoolModelWithValidValues() { // 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 }); _mockOdsApiFacadeFactory.Setup(x => x.Create()) .Returns(Task.FromResult(_mockOdsApiFacade.Object)); var validator = new AddSchoolModelValidator(_mockOdsApiFacadeFactory.Object); validator.ShouldValidate(_addSchoolModel); }
public void ShouldValidateAddSchoolModelWithValidValues() { // 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 AddSchoolModelValidator(); validator.ShouldValidate(_addSchoolModel); EducationOrganizationValidationHelper .ProposedEducationOrganizationIdIsInUse(_addSchoolModel.SchoolId.Value, _mockOdsApiFacade.Object) .ShouldBeFalse(); }