public void testEcheckVerification() { EcheckVerification echeckverification = new EcheckVerification(); echeckverification.OrderId = "12345"; echeckverification.Amount = 123456; echeckverification.OrderSource = OrderSourceType.Ecommerce; EcheckType echeck = new EcheckType(); echeck.AccType = EcheckAccountTypeEnum.Checking; echeck.AccNum = "12345657890"; echeck.RoutingNum = "123456789"; echeck.CheckNum = "123455"; echeckverification.Echeck = echeck; Contact contact = new Contact(); contact.Name = "Bob"; contact.City = "lowell"; contact.State = "MA"; contact.Email = "litle.com"; echeckverification.BillToAddress = contact; var mockLitleResponse = new Mock<LitleResponse>(); var mockLitleXmlSerializer = new Mock<LitleXmlSerializer>(); mockXmlReader.SetupSequence(XmlReader => XmlReader.ReadOuterXml()) .Returns("<echeckVerificationResponse xmlns='http://www.litle.com/schema'><litleTxnId>123</litleTxnId></echeckVerificationResponse>") .Returns("<echeckVerificationResponse xmlns='http://www.litle.com/schema'><litleTxnId>124</litleTxnId></echeckVerificationResponse>"); BatchResponse mockedLitleBatchResponse = new BatchResponse(); mockedLitleBatchResponse.SetEcheckVerificationResponseReader(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.AddEcheckVerification(echeckverification); litleBatchRequest.AddEcheckVerification(echeckverification); litle.AddBatch(litleBatchRequest); string batchFileName = litle.SendToLitle(); LitleResponse actualLitleResponse = litle.ReceiveFromLitle(batchFileName); BatchResponse actualLitleBatchResponse = actualLitleResponse.NextBatchResponse(); EcheckVerificationResponse actualEcheckVerificationResponse1 = actualLitleBatchResponse.NextEcheckVerificationResponse(); EcheckVerificationResponse actualEcheckVerificationResponse2 = actualLitleBatchResponse.NextEcheckVerificationResponse(); EcheckVerificationResponse nullEcheckVerificationResponse = actualLitleBatchResponse.NextEcheckVerificationResponse(); Assert.AreEqual(123, actualEcheckVerificationResponse1.LitleTxnId); Assert.AreEqual(124, actualEcheckVerificationResponse2.LitleTxnId); Assert.IsNull(nullEcheckVerificationResponse); 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)); }