public void testAccountUpdate() { accountUpdate accountUpdate = new accountUpdate(); accountUpdate.reportGroup = "Planets"; accountUpdate.orderId = "12344"; cardType card = new cardType(); card.type = methodOfPaymentTypeEnum.VI; card.number = "4100000000000002"; card.expDate = "1210"; accountUpdate.card = card; var mockLitleResponse = new Mock<litleResponse>(); var mockLitleXmlSerializer = new Mock<litleXmlSerializer>(); mockXmlReader.SetupSequence(XmlReader => XmlReader.ReadOuterXml()) .Returns("<accountUpdateResponse reportGroup=\"Merch01ReportGrp\" xmlns=\"http://www.litle.com/schema\"><litleTxnId>123</litleTxnId><orderId>MERCH01-0002</orderId><response>000</response><responseTime>2010-04-11T15:44:26</responseTime><message>Approved</message></accountUpdateResponse>") .Returns("<accountUpdateResponse reportGroup=\"Merch01ReportGrp\" xmlns=\"http://www.litle.com/schema\"><litleTxnId>124</litleTxnId><orderId>MERCH01-0002</orderId><response>000</response><responseTime>2010-04-11T15:44:26</responseTime><message>Approved</message></accountUpdateResponse>"); batchResponse mockLitleBatchResponse = new batchResponse(); mockLitleBatchResponse.setAccountUpdateResponseReader(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.addAccountUpdate(accountUpdate); litleBatchRequest.addAccountUpdate(accountUpdate); litle.addBatch(litleBatchRequest); string batchFileName = litle.sendToLitle(); litleResponse actualLitleResponse = litle.receiveFromLitle(batchFileName); batchResponse actualLitleBatchResponse = actualLitleResponse.nextBatchResponse(); accountUpdateResponse actualAccountUpdateResponse1 = actualLitleBatchResponse.nextAccountUpdateResponse(); accountUpdateResponse actualAccountUpdateResponse2 = actualLitleBatchResponse.nextAccountUpdateResponse(); accountUpdateResponse nullAccountUpdateResponse = actualLitleBatchResponse.nextAccountUpdateResponse(); Assert.AreEqual(123, actualAccountUpdateResponse1.litleTxnId); Assert.AreEqual("000", actualAccountUpdateResponse1.response); Assert.AreEqual(124, actualAccountUpdateResponse2.litleTxnId); Assert.AreEqual("000", actualAccountUpdateResponse2.response); Assert.IsNull(nullAccountUpdateResponse); 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)); }