public void UpdateStatusShouldThrowExceptionIfMerchantDoesNotExist() { var updateTransaction = new TransactionPayment() { TransactionId = 1, Payment = new TransactionPaymentDetails() }; var sut = new Services.PaymentRepository(); Assert.Throws <ArgumentException>(() => sut.UpdateTransactionStatus(updateTransaction, 1).Result); }
public void UpdateStatusShouldOnlyChangeStatus() { var merchantId = 1; var supplierId = "1"; var transactionId = 1; var expectedTransaction = new TransactionPayment() { TransactionId = transactionId, Status = PaymentStatus.Failed, Payment = new TransactionPaymentDetails() { SupplierId = supplierId, Amount = 1, CardNumber = 1, CCV = 1, Timestamp = DateTime.MaxValue } }; var sut = new Services.PaymentRepository(); sut.Insert(expectedTransaction, merchantId).Wait(); var updateTransaction = new TransactionPayment() { TransactionId = transactionId, Status = PaymentStatus.Success, Payment = new TransactionPaymentDetails() { SupplierId = supplierId, Amount = 2, CardNumber = 2, CCV = 2, Timestamp = DateTime.MaxValue } }; var actual = sut.UpdateTransactionStatus(updateTransaction, merchantId).Result; Assert.NotNull(actual); Assert.Equal(expectedTransaction, actual); }
public void UpdateStatusShouldThrowExceptionIfTransactionDoesNotExist() { var merchantId = 1; var transactionId = 1; var expectedTransaction = new TransactionPayment() { TransactionId = transactionId, Payment = new TransactionPaymentDetails() }; var updateTransaction = new TransactionPayment() { TransactionId = 2, Payment = new TransactionPaymentDetails() }; var sut = new Services.PaymentRepository(); sut.Insert(expectedTransaction, merchantId).Wait(); Assert.Throws <ArgumentException>(() => sut.UpdateTransactionStatus(updateTransaction, merchantId).Result); }