public void testBalanceInquiry() { BalanceInquiry balanceInquiry = new BalanceInquiry(); balanceInquiry.OrderId = "theOrderId"; balanceInquiry.OrderSource = OrderSourceType.Ecommerce; balanceInquiry.Card = new CardType(); var mockLitleResponse = new Mock<LitleResponse>(); var mockLitleXmlSerializer = new Mock<LitleXmlSerializer>(); mockXmlReader.SetupSequence(XmlReader => XmlReader.ReadOuterXml()) .Returns("<balanceInquiryResponse xmlns=\"http://www.litle.com/schema\"><litleTxnId>123</litleTxnId></balanceInquiryResponse>") .Returns("<balanceInquiryResponse xmlns=\"http://www.litle.com/schema\"><litleTxnId>124</litleTxnId></balanceInquiryResponse>"); BatchResponse mockLitleBatchResponse = new BatchResponse(); mockLitleBatchResponse.SetBalanceInquiryResponseReader(mockXmlReader.Object); mockLitleResponse.Setup(litleResponse => litleResponse.NextBatchResponse()).Returns(mockLitleBatchResponse); LitleResponse mockedLitleResponse = mockLitleResponse.Object; mockLitleXmlSerializer.Setup(litleXmlSerializer => litleXmlSerializer.DeserializeObjectFromFile(It.IsAny<String>())).Returns(mockedLitleResponse); Communications mockedCommunication = mockCommunications.Object; litle.SetCommunication(mockedCommunication); LitleXmlSerializer mockedLitleXmlSerializer = mockLitleXmlSerializer.Object; litle.SetLitleXmlSerializer(mockedLitleXmlSerializer); LitleFile mockedLitleFile = mockLitleFile.Object; litle.SetLitleFile(mockedLitleFile); litle.SetLitleTime(mockLitleTime.Object); BatchRequest litleBatchRequest = new BatchRequest(); litleBatchRequest.SetLitleFile(mockedLitleFile); litleBatchRequest.SetLitleTime(mockLitleTime.Object); litleBatchRequest.AddBalanceInquiry(balanceInquiry); litleBatchRequest.AddBalanceInquiry(balanceInquiry); litle.AddBatch(litleBatchRequest); string batchFileName = litle.SendToLitle(); LitleResponse actualLitleResponse = litle.ReceiveFromLitle(batchFileName); BatchResponse actualLitleBatchResponse = actualLitleResponse.NextBatchResponse(); Assert.AreSame(mockLitleBatchResponse, actualLitleBatchResponse); Assert.AreEqual(123, actualLitleBatchResponse.NextBalanceInquiryResponse().LitleTxnId); Assert.AreEqual(124, actualLitleBatchResponse.NextBalanceInquiryResponse().LitleTxnId); Assert.IsNull(actualLitleBatchResponse.NextBalanceInquiryResponse()); 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)); }