public async Task ValidateAsync_WhenValid_Ok() { var card = CreateValidCard(); var validator = new CreditCardValidator(); var result = await validator.ValidateAsync(card); Assert.True(result.IsValid); }
public async Task ValidateAsync_WhenExpiryMonthOutOfBounds_IsInvalid(int expiryMonth) { var card = CreateValidCard(); card.ExpiryMonth = expiryMonth; var validator = new CreditCardValidator(); var result = await validator.ValidateAsync(card); Assert.False(result.IsValid); }
public async Task ValidateAsync_WhenCCV4Digits_IsValid(string ccv) { var card = CreateValidCard(); card.CCV = ccv; var validator = new CreditCardValidator(); var result = await validator.ValidateAsync(card); Assert.True(result.IsValid); }
public async Task ValidateAsync_WhenCardNumberValid_IsValid(string cardNumber) { var card = CreateValidCard(); card.CardNumber = cardNumber; var validator = new CreditCardValidator(); var result = await validator.ValidateAsync(card); Assert.True(result.IsValid); }
public async Task ValidateAsync_WhenNameOnCardInvalid_IsInvalid(string name) { var card = CreateValidCard(); card.NameOnCard = name; var validator = new CreditCardValidator(); var result = await validator.ValidateAsync(card); Assert.False(result.IsValid); }
public async Task ValidateAsync_WhenExpiryYearInvalid_IsInvalid(int expiryYear) { var card = CreateValidCard(); card.ExpiryYear = expiryYear; var validator = new CreditCardValidator(); var result = await validator.ValidateAsync(card); Assert.False(result.IsValid); }