public async void CurrencyCode_Update_length() { Mock <ICountryRegionCurrencyRepository> countryRegionCurrencyRepository = new Mock <ICountryRegionCurrencyRepository>(); countryRegionCurrencyRepository.Setup(x => x.Get(It.IsAny <string>())).Returns(Task.FromResult(new CountryRegionCurrency())); var validator = new ApiCountryRegionCurrencyRequestModelValidator(countryRegionCurrencyRepository.Object); await validator.ValidateUpdateAsync(default(string), new ApiCountryRegionCurrencyRequestModel()); validator.ShouldHaveValidationErrorFor(x => x.CurrencyCode, new string('A', 4)); }
public async void CurrencyCode_Create_Invalid_Reference() { Mock <ICountryRegionCurrencyRepository> countryRegionCurrencyRepository = new Mock <ICountryRegionCurrencyRepository>(); countryRegionCurrencyRepository.Setup(x => x.GetCurrency(It.IsAny <string>())).Returns(Task.FromResult <Currency>(null)); var validator = new ApiCountryRegionCurrencyRequestModelValidator(countryRegionCurrencyRepository.Object); await validator.ValidateCreateAsync(new ApiCountryRegionCurrencyRequestModel()); validator.ShouldHaveValidationErrorFor(x => x.CurrencyCode, "A"); }