public void TestDeactivateReversalResponseCanContainGiftCardResponse() { String xml = @" <deactivateReversalResponse 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> </deactivateReversalResponse>"; XmlSerializer serializer = new XmlSerializer(typeof(deactivateReversalResponse)); StringReader reader = new StringReader(xml); deactivateReversalResponse deactivateReversalResponse = (deactivateReversalResponse)serializer.Deserialize(reader); Assert.AreEqual("theId", deactivateReversalResponse.id); Assert.AreEqual("theCustomerId", deactivateReversalResponse.customerId); Assert.AreEqual("theReportGroup", deactivateReversalResponse.reportGroup); Assert.AreEqual(1, deactivateReversalResponse.cnpTxnId); Assert.AreEqual("000", deactivateReversalResponse.response); Assert.AreEqual(new DateTime(2013, 9, 5, 14, 23, 45), deactivateReversalResponse.responseTime); Assert.AreEqual(new DateTime(2013, 9, 5), deactivateReversalResponse.postDate); Assert.AreEqual("Foo", deactivateReversalResponse.message); Assert.AreEqual("5", deactivateReversalResponse.giftCardResponse.availableBalance); }
public deactivateReversalResponse DeactivateReversal(deactivateReversal deactivateReversal) { litleOnlineRequest request = createLitleOnlineRequest(); request.deactivateReversal = deactivateReversal; litleOnlineResponse response = sendToLitle(request); deactivateReversalResponse deactivateReversalResponse = response.deactivateReversalResponse; return(deactivateReversalResponse); }
public void TestSimple() { deactivateReversal deactivateReversal = new deactivateReversal(); deactivateReversal.id = "a"; deactivateReversal.reportGroup = "b"; deactivateReversal.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'><deactivateReversalResponse><litleTxnId>123</litleTxnId></deactivateReversalResponse></litleOnlineResponse>"); Communications mockedCommunication = mock.Object; litle.setCommunication(mockedCommunication); deactivateReversalResponse response = litle.DeactivateReversal(deactivateReversal); Assert.AreEqual("123", response.litleTxnId); }