public void testEcheckSale() { var echecksale = new echeckSale(); echecksale.orderId = "12345"; echecksale.amount = 123456; echecksale.orderSource = orderSourceType.ecommerce; var echeck = new echeckType(); echeck.accType = echeckAccountTypeEnum.Checking; echeck.accNum = "12345657890"; echeck.routingNum = "123456789"; echeck.checkNum = "123455"; echecksale.echeck = echeck; var contact = new contact(); contact.name = "Bob"; contact.city = "lowell"; contact.state = "MA"; contact.email = "litle.com"; echecksale.billToAddress = contact; var mockLitleResponse = new Mock<litleResponse>(); var mockLitleXmlSerializer = new Mock<litleXmlSerializer>(); mockXmlReader.SetupSequence(XmlReader => XmlReader.ReadOuterXml()) .Returns( "<echeckSalesResponse xmlns='http://www.litle.com/schema'><litleTxnId>123</litleTxnId></echeckSalesResponse>") .Returns( "<echeckSalesResponse xmlns='http://www.litle.com/schema'><litleTxnId>124</litleTxnId></echeckSalesResponse>"); var mockedLitleBatchResponse = new batchResponse(); mockedLitleBatchResponse.setEcheckSalesResponseReader(mockXmlReader.Object); mockLitleResponse.Setup(litleResponse => litleResponse.nextBatchResponse()) .Returns(mockedLitleBatchResponse); var mockedLitleResponse = mockLitleResponse.Object; var mockedCommunications = mockCommunications.Object; mockLitleXmlSerializer.Setup( litleXmlSerializer => litleXmlSerializer.DeserializeObjectFromString(It.IsAny<string>())) .Returns(mockedLitleResponse); var mockedLitleXmlSerializer = mockLitleXmlSerializer.Object; var mockedLitleFile = mockLitleFile.Object; litle.setCommunication(mockedCommunications); litle.setLitleXmlSerializer(mockedLitleXmlSerializer); litle.setLitleFile(mockedLitleFile); litle.setLitleTime(mockLitleTime.Object); var litleBatchRequest = new batchRequest(_mockCache.Object); litleBatchRequest.setLitleFile(mockedLitleFile); litleBatchRequest.setLitleTime(mockLitleTime.Object); litleBatchRequest.addEcheckSale(echecksale); litleBatchRequest.addEcheckSale(echecksale); litle.addBatch(litleBatchRequest); var batchFileName = litle.sendToLitle(); var actualLitleResponse = litle.receiveFromLitle(batchFileName); var actualLitleBatchResponse = actualLitleResponse.nextBatchResponse(); var actualEcheckSalesResponse1 = actualLitleBatchResponse.nextEcheckSalesResponse(); var actualEcheckSalesResponse2 = actualLitleBatchResponse.nextEcheckSalesResponse(); var nullEcheckSalesResponse = actualLitleBatchResponse.nextEcheckSalesResponse(); Assert.AreEqual(123, actualEcheckSalesResponse1.litleTxnId); Assert.AreEqual(124, actualEcheckSalesResponse2.litleTxnId); Assert.IsNull(nullEcheckSalesResponse); mockCommunications.Verify( Communications => Communications.FtpDropOff(It.IsAny<string>(), mockFileName, It.IsAny<Dictionary<string, string>>())); mockCommunications.Verify( Communications => Communications.FtpPickUp(It.IsAny<string>(), It.IsAny<Dictionary<string, string>>(), mockFileName)); }