public async void CardType_Update_null() { Mock <ICreditCardRepository> creditCardRepository = new Mock <ICreditCardRepository>(); creditCardRepository.Setup(x => x.Get(It.IsAny <int>())).Returns(Task.FromResult(new CreditCard())); var validator = new ApiCreditCardRequestModelValidator(creditCardRepository.Object); await validator.ValidateUpdateAsync(default(int), new ApiCreditCardRequestModel()); validator.ShouldHaveValidationErrorFor(x => x.CardType, null as string); }
private async void BeUniqueByCardNumber_Update_Not_Exists() { Mock <ICreditCardRepository> creditCardRepository = new Mock <ICreditCardRepository>(); creditCardRepository.Setup(x => x.ByCardNumber(It.IsAny <string>())).Returns(Task.FromResult <CreditCard>(null)); var validator = new ApiCreditCardRequestModelValidator(creditCardRepository.Object); await validator.ValidateUpdateAsync(default(int), new ApiCreditCardRequestModel()); validator.ShouldNotHaveValidationErrorFor(x => x.CardNumber, "A"); }