public void SimpleSaleWithSkipRealtimeAUFalse() { var saleObj = new sale { id = "1", amount = 106, cnpTxnId = 123456, orderId = "12344", orderSource = orderSourceType.ecommerce, skipRealtimeAU = false, card = new cardType { type = methodOfPaymentTypeEnum.VI, number = "4100000000000000", expDate = "1210" } }; Console.WriteLine(saleObj.Serialize()); var responseObj = _cnp.Sale(saleObj); StringAssert.AreEqualIgnoringCase("Approved", responseObj.message); }
public void TestSale() { var sale = new sale(); sale.orderId = "12344"; sale.amount = 106; sale.orderSource = orderSourceType.ecommerce; var card = new cardType(); card.type = methodOfPaymentTypeEnum.VI; card.number = "4100000000000002"; card.expDate = "1210"; sale.card = card; batchRequest.addSale(sale); Assert.AreEqual(1, batchRequest.getNumSale()); Assert.AreEqual(sale.amount, batchRequest.getSumOfSale()); mockCnpFile.Verify(cnpFile => cnpFile.createRandomFile(It.IsAny <string>(), It.IsAny <string>(), It.IsAny <string>(), mockCnpTime.Object)); mockCnpFile.Verify(cnpFile => cnpFile.AppendLineToFile(mockFilePath, sale.Serialize())); }
public void TestSaleWithCardAsync() { var saleObj = new sale { id = "1", amount = 106, cnpTxnId = 123456, orderId = "12344", orderSource = orderSourceType.ecommerce, card = new cardType { type = methodOfPaymentTypeEnum.VI, number = "4100000000000000", expDate = "1210" } }; Console.WriteLine(saleObj.Serialize()); CancellationToken cancellationToken = new CancellationToken(false); var responseObj = _cnp.SaleAsync(saleObj, cancellationToken); StringAssert.AreEqualIgnoringCase("000", responseObj.Result.response); }
public void testSale() { var sale = new sale(); sale.orderId = "12344"; sale.amount = 106; sale.orderSource = orderSourceType.ecommerce; var card = new cardType(); card.type = methodOfPaymentTypeEnum.VI; card.number = "4100000000000002"; card.expDate = "1210"; sale.card = card; batchRequest.addSale(sale); Assert.AreEqual(1, batchRequest.getNumSale()); Assert.AreEqual(sale.amount, batchRequest.getSumOfSale()); mockLitleFile.Verify( litleFile => litleFile.createRandomFile(It.IsAny<string>(), It.IsAny<string>(), It.IsAny<string>(), mockLitleTime.Object)); mockLitleFile.Verify(litleFile => litleFile.AppendLineToFile(mockFilePath, sale.Serialize())); }