public void testToken() { RegisterTokenRequestType token = new RegisterTokenRequestType(); token.OrderId = "12344"; token.AccountNumber = "1233456789103801"; var mockLitleResponse = new Mock<LitleResponse>(); var mockLitleXmlSerializer = new Mock<LitleXmlSerializer>(); mockXmlReader.SetupSequence(XmlReader => XmlReader.ReadOuterXml()) .Returns("<registerTokenResponse xmlns='http://www.litle.com/schema'><litleTxnId>123</litleTxnId></registerTokenResponse>") .Returns("<registerTokenResponse xmlns='http://www.litle.com/schema'><litleTxnId>124</litleTxnId></registerTokenResponse>"); BatchResponse mockedLitleBatchResponse = new BatchResponse(); mockedLitleBatchResponse.SetRegisterTokenResponseReader(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.AddRegisterTokenRequest(token); litleBatchRequest.AddRegisterTokenRequest(token); litle.AddBatch(litleBatchRequest); string batchFileName = litle.SendToLitle(); LitleResponse actualLitleResponse = litle.ReceiveFromLitle(batchFileName); BatchResponse actualLitleBatchResponse = actualLitleResponse.NextBatchResponse(); RegisterTokenResponse actualRegisterTokenResponse1 = actualLitleBatchResponse.NextRegisterTokenResponse(); RegisterTokenResponse actualRegisterTokenResponse2 = actualLitleBatchResponse.NextRegisterTokenResponse(); RegisterTokenResponse nullRegisterTokenResponse = actualLitleBatchResponse.NextRegisterTokenResponse(); Assert.AreEqual(123, actualRegisterTokenResponse1.LitleTxnId); Assert.AreEqual(124, actualRegisterTokenResponse2.LitleTxnId); Assert.IsNull(nullRegisterTokenResponse); 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)); }