public void testCaptureGivenAuth() { CaptureGivenAuth capturegivenauth = new CaptureGivenAuth(); capturegivenauth.OrderId = "12344"; capturegivenauth.Amount = 106; AuthInformation authinfo = new AuthInformation(); authinfo.AuthDate = new DateTime(2002, 10, 9); authinfo.AuthCode = "543216"; authinfo.AuthAmount = 12345; capturegivenauth.AuthInformation = authinfo; capturegivenauth.OrderSource = OrderSourceType.Ecommerce; CardType card = new CardType(); card.Type = MethodOfPaymentTypeEnum.VI; card.Number = "4100000000000001"; card.ExpDate = "1210"; capturegivenauth.Card = card; var mockLitleResponse = new Mock<LitleResponse>(); var mockLitleXmlSerializer = new Mock<LitleXmlSerializer>(); mockXmlReader.SetupSequence(XmlReader => XmlReader.ReadOuterXml()) .Returns("<captureGivenAuthResponse xmlns='http://www.litle.com/schema'><litleTxnId>123</litleTxnId></captureGivenAuthResponse>") .Returns("<captureGivenAuthResponse xmlns='http://www.litle.com/schema'><litleTxnId>124</litleTxnId></captureGivenAuthResponse>"); BatchResponse mockedLitleBatchResponse = new BatchResponse(); mockedLitleBatchResponse.SetCaptureGivenAuthResponseReader(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.AddCaptureGivenAuth(capturegivenauth); litleBatchRequest.AddCaptureGivenAuth(capturegivenauth); litle.AddBatch(litleBatchRequest); string batchFileName = litle.SendToLitle(); LitleResponse actualLitleResponse = litle.ReceiveFromLitle(batchFileName); BatchResponse actualLitleBatchResponse = actualLitleResponse.NextBatchResponse(); CaptureGivenAuthResponse actualCaptureGivenAuthReponse1 = actualLitleBatchResponse.NextCaptureGivenAuthResponse(); CaptureGivenAuthResponse actualCaptureGivenAuthReponse2 = actualLitleBatchResponse.NextCaptureGivenAuthResponse(); CaptureGivenAuthResponse nullCaptureGivenAuthReponse = actualLitleBatchResponse.NextCaptureGivenAuthResponse(); Assert.AreEqual(123, actualCaptureGivenAuthReponse1.LitleTxnId); Assert.AreEqual(124, actualCaptureGivenAuthReponse2.LitleTxnId); Assert.IsNull(nullCaptureGivenAuthReponse); 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)); }