public void testCredit() { Credit credit = new Credit(); credit.OrderId = "12344"; credit.Amount = 106; credit.OrderSource = OrderSourceType.Ecommerce; CardType card = new CardType(); card.Type = MethodOfPaymentTypeEnum.VI; card.Number = "4100000000000001"; card.ExpDate = "1210"; credit.Card = card; var mockLitleResponse = new Mock<LitleResponse>(); var mockLitleXmlSerializer = new Mock<LitleXmlSerializer>(); mockXmlReader.SetupSequence(XmlReader => XmlReader.ReadOuterXml()) .Returns("<creditResponse xmlns='http://www.litle.com/schema'><litleTxnId>123</litleTxnId></creditResponse>") .Returns("<creditResponse xmlns='http://www.litle.com/schema'><litleTxnId>124</litleTxnId></creditResponse>"); BatchResponse mockedLitleBatchResponse = new BatchResponse(); mockedLitleBatchResponse.SetCreditResponseReader(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.AddCredit(credit); litleBatchRequest.AddCredit(credit); litle.AddBatch(litleBatchRequest); string batchFileName = litle.SendToLitle(); LitleResponse actualLitleResponse = litle.ReceiveFromLitle(batchFileName); BatchResponse actualLitleBatchResponse = actualLitleResponse.NextBatchResponse(); CreditResponse actualCreditReponse1 = actualLitleBatchResponse.NextCreditResponse(); CreditResponse actualCreditReponse2 = actualLitleBatchResponse.NextCreditResponse(); CreditResponse nullCreditReponse1 = actualLitleBatchResponse.NextCreditResponse(); Assert.AreEqual(123, actualCreditReponse1.LitleTxnId); Assert.AreEqual(124, actualCreditReponse2.LitleTxnId); Assert.IsNull(nullCreditReponse1); 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)); }