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); }
public void testLoadReversal_Full() { loadReversal loadReversal = new loadReversal(); loadReversal.id = "theId"; loadReversal.reportGroup = "theReportGroup"; loadReversal.customerId = "theCustomerId"; loadReversal.litleTxnId = "123"; String actual = loadReversal.Serialize(); String expected = @" <loadReversal id=""theId"" customerId=""theCustomerId"" reportGroup=""theReportGroup""> <litleTxnId>123</litleTxnId> </loadReversal>"; Assert.AreEqual(expected, actual); }
public loadReversalResponse LoadReversal(loadReversal loadReversal) { litleOnlineRequest request = createLitleOnlineRequest(); request.loadReversal = loadReversal; litleOnlineResponse response = sendToLitle(request); loadReversalResponse loadReversalResponse = response.loadReversalResponse; return loadReversalResponse; }