public async Task <IActionResult> Create([FromBody] CardEditModel model) { if (model.isValid()) { var result = await service.CreateAsync(model); return(Ok(result)); } return(ValidationProblem()); }
public void CreditCardCVVTooSmall() { var model = new CardEditModel { CardNumber = 12345678, CustomerId = 1, CVV = 0 }; Assert.False(model.isValid()); }
public void CreditCardNumberTooSmall() { var model = new CardEditModel { CardNumber = 0, CustomerId = 1, CVV = 654 }; Assert.False(model.isValid()); }
public void CreditCardCVVTooBig() { var model = new CardEditModel { CardNumber = 123456789, CustomerId = 1, CVV = 654321 }; Assert.False(model.isValid()); }
public void ValidCreditCard() { var model = new CardEditModel { CardNumber = 123456, CustomerId = 1, CVV = 654 }; Assert.True(model.isValid()); }