public void testForceCapture() { ForceCapture forcecapture = new ForceCapture(); forcecapture.OrderId = "12344"; forcecapture.Amount = 106; forcecapture.OrderSource = OrderSourceType.Ecommerce; CardType card = new CardType(); card.Type = MethodOfPaymentTypeEnum.VI; card.Number = "4100000000000001"; card.ExpDate = "1210"; forcecapture.Card = card; var mockLitleResponse = new Mock<LitleResponse>(); var mockLitleXmlSerializer = new Mock<LitleXmlSerializer>(); mockXmlReader.SetupSequence(XmlReader => XmlReader.ReadOuterXml()) .Returns("<forceCaptureResponse xmlns='http://www.litle.com/schema'><litleTxnId>123</litleTxnId></forceCaptureResponse>") .Returns("<forceCaptureResponse xmlns='http://www.litle.com/schema'><litleTxnId>124</litleTxnId></forceCaptureResponse>"); BatchResponse mockedLitleBatchResponse = new BatchResponse(); mockedLitleBatchResponse.SetForceCaptureResponseReader(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.AddForceCapture(forcecapture); litleBatchRequest.AddForceCapture(forcecapture); litle.AddBatch(litleBatchRequest); string batchFileName = litle.SendToLitle(); LitleResponse actualLitleResponse = litle.ReceiveFromLitle(batchFileName); BatchResponse actualLitleBatchResponse = actualLitleResponse.NextBatchResponse(); ForceCaptureResponse actualForceCaptureResponse1 = actualLitleBatchResponse.NextForceCaptureResponse(); ForceCaptureResponse actualForceCaptureResponse2 = actualLitleBatchResponse.NextForceCaptureResponse(); ForceCaptureResponse nullForceCaptureResponse = actualLitleBatchResponse.NextForceCaptureResponse(); Assert.AreEqual(123, actualForceCaptureResponse1.LitleTxnId); Assert.AreEqual(124, actualForceCaptureResponse2.LitleTxnId); Assert.IsNull(nullForceCaptureResponse); 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)); }