public async void Name_Update_length() { Mock <IPhoneNumberTypeRepository> phoneNumberTypeRepository = new Mock <IPhoneNumberTypeRepository>(); phoneNumberTypeRepository.Setup(x => x.Get(It.IsAny <int>())).Returns(Task.FromResult(new PhoneNumberType())); var validator = new ApiPhoneNumberTypeRequestModelValidator(phoneNumberTypeRepository.Object); await validator.ValidateUpdateAsync(default(int), new ApiPhoneNumberTypeRequestModel()); validator.ShouldHaveValidationErrorFor(x => x.Name, new string('A', 51)); }
public async void Name_Create_null() { Mock <IPhoneNumberTypeRepository> phoneNumberTypeRepository = new Mock <IPhoneNumberTypeRepository>(); phoneNumberTypeRepository.Setup(x => x.Get(It.IsAny <int>())).Returns(Task.FromResult(new PhoneNumberType())); var validator = new ApiPhoneNumberTypeRequestModelValidator(phoneNumberTypeRepository.Object); await validator.ValidateCreateAsync(new ApiPhoneNumberTypeRequestModel()); validator.ShouldHaveValidationErrorFor(x => x.Name, null as string); }