public void TesteCriarPaymentHandlerValidar() { var payCommand = new CriarPaymentCommand(new Guid(), DateTime.Now, "Afonso", "Visa", "1234567891011115", DateTime.Now.AddMonths(9), 32, 8523, 1); payCommand.Validar(); var result = _criarPaymentHandler.Handle(payCommand).Result; Assert.False(result.HasFails); }
async Task <bool> AddDataBase(CriarPaymentCommand request) { request.Validar(); if (request.Notifications.Any()) { _response.AddNotifications(request.Notifications); return(false); } // Armazena informação da transação de pagamento var payment = _mapper.Map <Payment>(request); await _unitOfWork.PaymentRepository.InsertAsync(payment); await _unitOfWork.CommitAsync(); return(true); }
async Task <bool> AddDataBase(CriarPaymentCommand request) { request.Validar(); if (request.Notifications.Any()) { _response.AddNotifications(request.Notifications); return(false); } // Armazena informação da transação de pagamento var payment = _mapper.Map <Payment>(request); //Payment payment = new Payment(request.PayId, DateTime.Now, request.Name, request.Bandeira, request.NumeroCartao, request.Vencimento, // request.CodigoSeguranca, request.Valor, request.Status); await _unitOfWork.PaymentRepository.InsertAsync(payment); await _unitOfWork.CommitAsync(); return(true); }
public void AddDataBaseTest() { var request = new CriarPaymentCommand { PayId = Guid.NewGuid(), CreatedAt = DateTime.Now, Name = "VISA", Bandeira = "VISA", NumeroCartao = "1234567890123456", Vencimento = DateTime.Now, CodigoSeguranca = 123, Valor = 125.52, Status = 1 }; request.Validar(); var payment = _mapper.Map <Payment>(request); _unitOfWork.PaymentRepository.InsertAsync(payment).Wait(); _unitOfWork.CommitAsync().Wait(); Assert.False(request.Notifications.Any()); }