public async void AddressLine2_Update_length() { Mock <IAddressRepository> addressRepository = new Mock <IAddressRepository>(); addressRepository.Setup(x => x.Get(It.IsAny <int>())).Returns(Task.FromResult(new Address())); var validator = new ApiAddressRequestModelValidator(addressRepository.Object); await validator.ValidateUpdateAsync(default(int), new ApiAddressRequestModel()); validator.ShouldHaveValidationErrorFor(x => x.AddressLine2, new string('A', 61)); }
private async void BeUniqueByAddressLine1AddressLine2CityStateProvinceIDPostalCode_Update_Not_Exists() { Mock <IAddressRepository> addressRepository = new Mock <IAddressRepository>(); addressRepository.Setup(x => x.ByAddressLine1AddressLine2CityStateProvinceIDPostalCode(It.IsAny <string>(), It.IsAny <string>(), It.IsAny <string>(), It.IsAny <int>(), It.IsAny <string>())).Returns(Task.FromResult <Address>(null)); var validator = new ApiAddressRequestModelValidator(addressRepository.Object); await validator.ValidateUpdateAsync(default(int), new ApiAddressRequestModel()); validator.ShouldNotHaveValidationErrorFor(x => x.AddressLine1, "A"); }
public async void AddressLine1_Create_null() { Mock <IAddressRepository> addressRepository = new Mock <IAddressRepository>(); addressRepository.Setup(x => x.Get(It.IsAny <int>())).Returns(Task.FromResult(new Address())); var validator = new ApiAddressRequestModelValidator(addressRepository.Object); await validator.ValidateCreateAsync(new ApiAddressRequestModel()); validator.ShouldHaveValidationErrorFor(x => x.AddressLine1, null as string); }
public async void PostalCode_Create_length() { Mock <IAddressRepository> addressRepository = new Mock <IAddressRepository>(); addressRepository.Setup(x => x.Get(It.IsAny <int>())).Returns(Task.FromResult(new Address())); var validator = new ApiAddressRequestModelValidator(addressRepository.Object); await validator.ValidateCreateAsync(new ApiAddressRequestModel()); validator.ShouldHaveValidationErrorFor(x => x.PostalCode, new string('A', 16)); }