public void LoadReversal() { loadReversal reversal = new loadReversal(); reversal.id = "1"; reversal.reportGroup = "planets"; reversal.litleTxnId = 123456000; giftCardCardType card = new giftCardCardType(); card.type = methodOfPaymentTypeEnum.GC; card.number = "414100000000000000"; card.expDate = "1210"; card.pin = "1234"; reversal.card = card; reversal.originalRefCode = "123"; reversal.originalAmount = 123; reversal.originalTxnTime = new DateTime(2017, 01, 01); reversal.originalSystemTraceId = 123; reversal.originalSequenceNumber = "123456"; var mock = new Mock <Communications>(); mock.Setup(Communications => Communications.HttpPost(It.IsRegex(".*<litleTxnId>123456000</litleTxnId>\r\n<card>\r\n<type>GC</type>\r\n<number>414100000000000000</number>\r\n<expDate>1210</expDate>\r\n<pin>1234</pin>\r\n</card>\r\n<originalRefCode>123</originalRefCode>\r\n<originalAmount>123</originalAmount>\r\n<originalTxnTime>2017-01-01T00:00:00Z</originalTxnTime>\r\n<originalSystemTraceId>123</originalSystemTraceId>\r\n<originalSequenceNumber>123456</originalSequenceNumber>.*", RegexOptions.Singleline), It.IsAny <Dictionary <String, String> >())) .Returns("<litleOnlineResponse version='8.14' response='0' message='Valid Format' xmlns='http://www.litle.com/schema'><authReversalResponse><litleTxnId>123</litleTxnId></authReversalResponse></litleOnlineResponse>"); Communications mockedCommunication = mock.Object; litle.setCommunication(mockedCommunication); litle.LoadReversal(reversal); }
public void LoadReversal() { var reversal = new loadReversal { id = "1", reportGroup = "planets", litleTxnId = 123456000, card = new giftCardCardType { type = methodOfPaymentTypeEnum.GC, number = "414100000000000000", expDate = "1210", pin = "1234" }, originalRefCode = "123", originalAmount = 123, originalTxnTime = DateTime.Now, originalSystemTraceId = 123, originalSequenceNumber = "123456" }; var response = _litle.LoadReversal(reversal); Assert.AreEqual("Approved", response.message); }
public void TestSimple() { loadReversal loadReversal = new loadReversal(); loadReversal.id = "a"; loadReversal.reportGroup = "b"; loadReversal.litleTxnId = "123"; var mock = new Mock <Communications>(); mock.Setup(Communications => Communications.HttpPost(It.IsRegex(".*<litleTxnId>123</litleTxnId>.*", RegexOptions.Singleline), It.IsAny <Dictionary <String, String> >())) .Returns("<litleOnlineResponse version='8.22' response='0' message='Valid Format' xmlns='http://www.litle.com/schema'><loadReversalResponse><litleTxnId>123</litleTxnId></loadReversalResponse></litleOnlineResponse>"); Communications mockedCommunication = mock.Object; litle.setCommunication(mockedCommunication); loadReversalResponse response = litle.LoadReversal(loadReversal); Assert.AreEqual("123", response.litleTxnId); }