public async void Email_Create_length() { Mock <IStudentRepository> studentRepository = new Mock <IStudentRepository>(); studentRepository.Setup(x => x.Get(It.IsAny <int>())).Returns(Task.FromResult(new Student())); var validator = new ApiStudentServerRequestModelValidator(studentRepository.Object); await validator.ValidateCreateAsync(new ApiStudentServerRequestModel()); validator.ShouldHaveValidationErrorFor(x => x.Email, new string('A', 129)); }
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 ApiStudentServerRequestModelValidator(studentRepository.Object); await validator.ValidateCreateAsync(new ApiStudentServerRequestModel()); validator.ShouldNotHaveValidationErrorFor(x => x.FamilyId, 1); }
public async void Phone_Create_null() { Mock <IStudentRepository> studentRepository = new Mock <IStudentRepository>(); studentRepository.Setup(x => x.Get(It.IsAny <int>())).Returns(Task.FromResult(new Student())); var validator = new ApiStudentServerRequestModelValidator(studentRepository.Object); await validator.ValidateCreateAsync(new ApiStudentServerRequestModel()); validator.ShouldHaveValidationErrorFor(x => x.Phone, null as string); }