public void ShouldReturnErrorWhenCreditCardNumberIsInvalid() { var command = new CreateCreditCardPaymentCommand(); command.CardNumber = "12346546"; command.ValidDate = DateTime.Now.AddDays(1); command.Valdiate().IsValid.Should().Be(false); }
public void ShouldReturnSuccessWhenCreditCardNumberIsValid() { // Para gerar o cartão foi usado https://ccardgenerator.com/generat-visa-card-numbers.php var command = new CreateCreditCardPaymentCommand(); command.CardNumber = "4526923734292204"; command.ValidDate = DateTime.Now.AddDays(1); command.Valdiate().IsValid.Should().Be(true); }
public async Task <IActionResult> Payment([FromBody] CreateCreditCardPaymentCommand payment) { var commandResult = await _mediator.Send(payment); return(TransactionResponse(commandResult)); }