public void ShouldValidateAddLocalEducationAgencyModelWithValidValues() { // 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 AddLocalEducationAgencyModelValidator(_mockOdsApiFacadeFactory.Object); validator.ShouldValidate(_addLocalEducationAgencyModel); }
public void ShouldValidateAddLocalEducationAgencyModelWithValidValues() { // 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 AddLocalEducationAgencyModelValidator(); validator.ShouldValidate(_addLocalEducationAgencyModel); EducationOrganizationValidationHelper .ProposedEducationOrganizationIdIsInUse(_addLocalEducationAgencyModel.LocalEducationAgencyId.Value, _mockOdsApiFacade.Object) .ShouldBeFalse(); }