public void testEcheckSale() { EcheckSale echecksale = new EcheckSale(); echecksale.OrderId = "12345"; echecksale.Amount = 123456; echecksale.OrderSource = OrderSourceType.Ecommerce; EcheckType echeck = new EcheckType(); echeck.AccType = EcheckAccountTypeEnum.Checking; echeck.AccNum = "12345657890"; echeck.RoutingNum = "123456789"; echeck.CheckNum = "123455"; echecksale.Echeck = echeck; Contact 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>"); BatchResponse mockedLitleBatchResponse = new BatchResponse(); mockedLitleBatchResponse.SetEcheckSalesResponseReader(mockXmlReader.Object); mockLitleResponse.Setup(litleResponse => litleResponse.NextBatchResponse()).Returns(mockedLitleBatchResponse); LitleResponse mockedLitleResponse = mockLitleResponse.Object; Communications mockedCommunications = mockCommunications.Object; mockLitleXmlSerializer.Setup(litleXmlSerializer => litleXmlSerializer.DeserializeObjectFromFile(It.IsAny<String>())).Returns(mockedLitleResponse); LitleXmlSerializer mockedLitleXmlSerializer = mockLitleXmlSerializer.Object; LitleFile mockedLitleFile = mockLitleFile.Object; litle.SetCommunication(mockedCommunications); litle.SetLitleXmlSerializer(mockedLitleXmlSerializer); litle.SetLitleFile(mockedLitleFile); litle.SetLitleTime(mockLitleTime.Object); BatchRequest litleBatchRequest = new BatchRequest(); litleBatchRequest.SetLitleFile(mockedLitleFile); litleBatchRequest.SetLitleTime(mockLitleTime.Object); litleBatchRequest.AddEcheckSale(echecksale); litleBatchRequest.AddEcheckSale(echecksale); litle.AddBatch(litleBatchRequest); string batchFileName = litle.SendToLitle(); LitleResponse actualLitleResponse = litle.ReceiveFromLitle(batchFileName); BatchResponse actualLitleBatchResponse = actualLitleResponse.NextBatchResponse(); EcheckSalesResponse actualEcheckSalesResponse1 = actualLitleBatchResponse.NextEcheckSalesResponse(); EcheckSalesResponse actualEcheckSalesResponse2 = actualLitleBatchResponse.NextEcheckSalesResponse(); EcheckSalesResponse 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)); }