public async void FromCurrencyCode_Create_Valid_Reference() { Mock <ICurrencyRateRepository> currencyRateRepository = new Mock <ICurrencyRateRepository>(); currencyRateRepository.Setup(x => x.CurrencyByFromCurrencyCode(It.IsAny <string>())).Returns(Task.FromResult <Currency>(new Currency())); var validator = new ApiCurrencyRateRequestModelValidator(currencyRateRepository.Object); await validator.ValidateCreateAsync(new ApiCurrencyRateRequestModel()); validator.ShouldNotHaveValidationErrorFor(x => x.FromCurrencyCode, "A"); }
private async void BeUniqueByCurrencyRateDateFromCurrencyCodeToCurrencyCode_Update_Not_Exists() { Mock <ICurrencyRateRepository> currencyRateRepository = new Mock <ICurrencyRateRepository>(); currencyRateRepository.Setup(x => x.ByCurrencyRateDateFromCurrencyCodeToCurrencyCode(It.IsAny <DateTime>(), It.IsAny <string>(), It.IsAny <string>())).Returns(Task.FromResult <CurrencyRate>(null)); var validator = new ApiCurrencyRateRequestModelValidator(currencyRateRepository.Object); await validator.ValidateUpdateAsync(default(int), new ApiCurrencyRateRequestModel()); validator.ShouldNotHaveValidationErrorFor(x => x.CurrencyRateDate, DateTime.Parse("1/1/1987 12:00:00 AM")); }