public async void ProvinceId_Update_Valid_Reference() { Mock <ICityRepository> cityRepository = new Mock <ICityRepository>(); cityRepository.Setup(x => x.GetProvince(It.IsAny <int>())).Returns(Task.FromResult <Province>(new Province())); var validator = new ApiCityRequestModelValidator(cityRepository.Object); await validator.ValidateUpdateAsync(default(int), new ApiCityRequestModel()); validator.ShouldNotHaveValidationErrorFor(x => x.ProvinceId, 1); }
public async void Name_Update_length() { Mock <ICityRepository> cityRepository = new Mock <ICityRepository>(); cityRepository.Setup(x => x.Get(It.IsAny <int>())).Returns(Task.FromResult(new City())); var validator = new ApiCityRequestModelValidator(cityRepository.Object); await validator.ValidateUpdateAsync(default(int), new ApiCityRequestModel()); validator.ShouldHaveValidationErrorFor(x => x.Name, new string('A', 129)); }