public void testEcheckCredit() { EcheckCredit echeckcredit = new EcheckCredit(); echeckcredit.Amount = 12; echeckcredit.LitleTxnId = 123456789101112; var mockLitleResponse = new Mock<LitleResponse>(); var mockLitleXmlSerializer = new Mock<LitleXmlSerializer>(); mockXmlReader.SetupSequence(XmlReader => XmlReader.ReadOuterXml()) .Returns("<echeckCreditResponse xmlns='http://www.litle.com/schema'><litleTxnId>123</litleTxnId></echeckCreditResponse>") .Returns("<echeckCreditResponse xmlns='http://www.litle.com/schema'><litleTxnId>124</litleTxnId></echeckCreditResponse>"); BatchResponse mockedLitleBatchResponse = new BatchResponse(); mockedLitleBatchResponse.SetEcheckCreditResponseReader(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.AddEcheckCredit(echeckcredit); litleBatchRequest.AddEcheckCredit(echeckcredit); litle.AddBatch(litleBatchRequest); string batchFileName = litle.SendToLitle(); LitleResponse actualLitleResponse = litle.ReceiveFromLitle(batchFileName); BatchResponse actualLitleBatchResponse = actualLitleResponse.NextBatchResponse(); EcheckCreditResponse actualEcheckCreditResponse1 = actualLitleBatchResponse.NextEcheckCreditResponse(); EcheckCreditResponse actualEcheckCreditResponse2 = actualLitleBatchResponse.NextEcheckCreditResponse(); EcheckCreditResponse nullEcheckCreditResponse = actualLitleBatchResponse.NextEcheckCreditResponse(); Assert.AreEqual(123, actualEcheckCreditResponse1.LitleTxnId); Assert.AreEqual(124, actualEcheckCreditResponse2.LitleTxnId); Assert.IsNull(nullEcheckCreditResponse); 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)); }