public async void Phone_Update_length() { Mock <IPersonRepository> personRepository = new Mock <IPersonRepository>(); personRepository.Setup(x => x.Get(It.IsAny <int>())).Returns(Task.FromResult(new Person())); var validator = new ApiPersonServerRequestModelValidator(personRepository.Object); await validator.ValidateUpdateAsync(default(int), new ApiPersonServerRequestModel()); validator.ShouldHaveValidationErrorFor(x => x.Phone, new string('A', 33)); }
public async void PersonName_Create_null() { Mock <IPersonRepository> personRepository = new Mock <IPersonRepository>(); personRepository.Setup(x => x.Get(It.IsAny <int>())).Returns(Task.FromResult(new Person())); var validator = new ApiPersonServerRequestModelValidator(personRepository.Object); await validator.ValidateCreateAsync(new ApiPersonServerRequestModel()); validator.ShouldHaveValidationErrorFor(x => x.PersonName, null as string); }