public async void FamilyId_Create_Valid_Reference() { Mock <IStudentRepository> studentRepository = new Mock <IStudentRepository>(); studentRepository.Setup(x => x.FamilyByFamilyId(It.IsAny <int>())).Returns(Task.FromResult <Family>(new Family())); var validator = new ApiStudentRequestModelValidator(studentRepository.Object); await validator.ValidateCreateAsync(new ApiStudentRequestModel()); validator.ShouldNotHaveValidationErrorFor(x => x.FamilyId, 1); }
public async void UserId_Update_Valid_Reference() { Mock <IStudentRepository> studentRepository = new Mock <IStudentRepository>(); studentRepository.Setup(x => x.UserByUserId(It.IsAny <int>())).Returns(Task.FromResult <User>(new User())); var validator = new ApiStudentRequestModelValidator(studentRepository.Object); await validator.ValidateUpdateAsync(default(int), new ApiStudentRequestModel()); validator.ShouldNotHaveValidationErrorFor(x => x.UserId, 1); }