public void testUpdateSubscription() { UpdateSubscription update = new UpdateSubscription(); update.BillingDate = new DateTime(2002, 10, 9); Contact billToAddress = new Contact(); billToAddress.Name = "Greg Dake"; billToAddress.City = "Lowell"; billToAddress.State = "MA"; billToAddress.Email = "*****@*****.**"; update.BillToAddress = billToAddress; CardType card = new CardType(); card.Number = "4100000000000001"; card.ExpDate = "1215"; card.Type = MethodOfPaymentTypeEnum.VI; update.Card = card; update.PlanCode = "abcdefg"; update.SubscriptionId = 12345; var mockLitleResponse = new Mock<LitleResponse>(); var mockLitleXmlSerializer = new Mock<LitleXmlSerializer>(); mockXmlReader.SetupSequence(XmlReader => XmlReader.ReadOuterXml()) .Returns("<updateSubscriptionResponse xmlns=\"http://www.litle.com/schema\"><litleTxnId>54321</litleTxnId><response>000</response><message>Approved</message><responseTime>2013-09-04T21:55:14</responseTime><subscriptionId>12345</subscriptionId></updateSubscriptionResponse>") .Returns("<updateSubscriptionResponse xmlns=\"http://www.litle.com/schema\"><litleTxnId>12345</litleTxnId><response>000</response><message>Approved</message><responseTime>2013-09-04T21:55:14</responseTime><subscriptionId>54321</subscriptionId></updateSubscriptionResponse>"); BatchResponse mockLitleBatchResponse = new BatchResponse(); mockLitleBatchResponse.SetUpdateSubscriptionResponseReader(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.AddUpdateSubscription(update); litle.AddBatch(litleBatchRequest); string batchFileName = litle.SendToLitle(); LitleResponse actualLitleResponse = litle.ReceiveFromLitle(batchFileName); BatchResponse actualLitleBatchResponse = actualLitleResponse.NextBatchResponse(); Assert.AreSame(mockLitleBatchResponse, actualLitleBatchResponse); Assert.AreEqual("12345", actualLitleBatchResponse.NextUpdateSubscriptionResponse().SubscriptionId); Assert.AreEqual("54321", actualLitleBatchResponse.NextUpdateSubscriptionResponse().SubscriptionId); Assert.IsNull(actualLitleBatchResponse.NextUpdateSubscriptionResponse()); 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)); }