public async void ProvinceId_Create_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.ValidateCreateAsync(new ApiCityRequestModel()); validator.ShouldNotHaveValidationErrorFor(x => x.ProvinceId, 1); }
public async void Name_Create_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.ValidateCreateAsync(new ApiCityRequestModel()); validator.ShouldHaveValidationErrorFor(x => x.Name, new string('A', 129)); }