public async void StudentId_Create_Valid_Reference() { Mock <IStudentXFamilyRepository> studentXFamilyRepository = new Mock <IStudentXFamilyRepository>(); studentXFamilyRepository.Setup(x => x.GetStudent(It.IsAny <int>())).Returns(Task.FromResult <Student>(new Student())); var validator = new ApiStudentXFamilyRequestModelValidator(studentXFamilyRepository.Object); await validator.ValidateCreateAsync(new ApiStudentXFamilyRequestModel()); validator.ShouldNotHaveValidationErrorFor(x => x.StudentId, 1); }
public async void FamilyId_Update_Valid_Reference() { Mock <IStudentXFamilyRepository> studentXFamilyRepository = new Mock <IStudentXFamilyRepository>(); studentXFamilyRepository.Setup(x => x.GetFamily(It.IsAny <int>())).Returns(Task.FromResult <Family>(new Family())); var validator = new ApiStudentXFamilyRequestModelValidator(studentXFamilyRepository.Object); await validator.ValidateUpdateAsync(default(int), new ApiStudentXFamilyRequestModel()); validator.ShouldNotHaveValidationErrorFor(x => x.FamilyId, 1); }