public void TestDepositReversalResponseCanContainGiftCardResponse() { String xml = @" <depositReversalResponse xmlns=""http://www.vantivcnp.com/schema"" id=""theId"" customerId=""theCustomerId"" reportGroup=""theReportGroup""> <cnpTxnId>1</cnpTxnId> <orderId>2</orderId> <response>000</response> <responseTime>2013-09-05T14:23:45</responseTime> <postDate>2013-09-05</postDate> <message>Foo</message> <giftCardResponse> <availableBalance>5</availableBalance> </giftCardResponse> </depositReversalResponse>"; XmlSerializer serializer = new XmlSerializer(typeof(depositReversalResponse)); StringReader reader = new StringReader(xml); depositReversalResponse depositReversalResponse = (depositReversalResponse)serializer.Deserialize(reader); Assert.AreEqual("theId", depositReversalResponse.id); Assert.AreEqual("theCustomerId", depositReversalResponse.customerId); Assert.AreEqual("theReportGroup", depositReversalResponse.reportGroup); Assert.AreEqual(1, depositReversalResponse.cnpTxnId); Assert.AreEqual("000", depositReversalResponse.response); Assert.AreEqual(new DateTime(2013, 9, 5, 14, 23, 45), depositReversalResponse.responseTime); Assert.AreEqual(new DateTime(2013, 9, 5), depositReversalResponse.postDate); Assert.AreEqual("Foo", depositReversalResponse.message); Assert.AreEqual("5", depositReversalResponse.giftCardResponse.availableBalance); }
public depositReversalResponse DepositReversal(depositReversal depositReversal) { litleOnlineRequest request = createLitleOnlineRequest(); request.depositReversal = depositReversal; litleOnlineResponse response = sendToLitle(request); depositReversalResponse depositReversalResponse = response.depositReversalResponse; return(depositReversalResponse); }
public void TestSimple() { depositReversal depositReversal = new depositReversal(); depositReversal.id = "a"; depositReversal.reportGroup = "b"; depositReversal.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'><depositReversalResponse><litleTxnId>123</litleTxnId></depositReversalResponse></litleOnlineResponse>"); Communications mockedCommunication = mock.Object; litle.setCommunication(mockedCommunication); depositReversalResponse response = litle.DepositReversal(depositReversal); Assert.AreEqual("123", response.litleTxnId); }