public void testCapture() { Capture capture = new Capture(); capture.LitleTxnId = 12345678000; capture.Amount = 106; var mockLitleResponse = new Mock<LitleResponse>(); var mockLitleXmlSerializer = new Mock<LitleXmlSerializer>(); mockXmlReader.SetupSequence(XmlReader => XmlReader.ReadOuterXml()) .Returns("<captureResponse id=\"123\" reportGroup=\"RG27\" xmlns=\"http://www.litle.com/schema\"> <litleTxnId>123</litleTxnId> <orderId>12z58743y1</orderId> <response>000</response> <responseTime>2011-09-01T10:24:31</responseTime> <message>message</message> </captureResponse>") .Returns("<captureResponse id=\"124\" reportGroup=\"RG27\" xmlns=\"http://www.litle.com/schema\"> <litleTxnId>124</litleTxnId> <orderId>12z58743y1</orderId> <response>000</response> <responseTime>2011-09-01T10:24:31</responseTime> <message>message</message> </captureResponse>"); BatchResponse mockedLitleBatchResponse = new BatchResponse(); mockedLitleBatchResponse.SetCaptureResponseReader(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.AddCapture(capture); litleBatchRequest.AddCapture(capture); litle.AddBatch(litleBatchRequest); string batchFileName = litle.SendToLitle(); LitleResponse actualLitleResponse = litle.ReceiveFromLitle(batchFileName); BatchResponse actualLitleBatchResponse = actualLitleResponse.NextBatchResponse(); CaptureResponse actualCaptureResponse1 = actualLitleBatchResponse.NextCaptureResponse(); CaptureResponse actualCaptureResponse2 = actualLitleBatchResponse.NextCaptureResponse(); CaptureResponse nullCaptureResponse = actualLitleBatchResponse.NextCaptureResponse(); Assert.AreEqual(123, actualCaptureResponse1.LitleTxnId); Assert.AreEqual(124, actualCaptureResponse2.LitleTxnId); Assert.IsNull(nullCaptureResponse); 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)); }