public void testCreatePlan() { createPlan createPlan = new createPlan(); batchRequest.addCreatePlan(createPlan); Assert.AreEqual(1, batchRequest.getNumCreatePlans()); mockLitleFile.Verify(litleFile => litleFile.createRandomFile(It.IsAny <String>(), It.IsAny <String>(), It.IsAny <String>(), mockLitleTime.Object)); mockLitleFile.Verify(litleFile => litleFile.AppendLineToFile(mockFilePath, createPlan.Serialize())); }
public void TestCreatePlan() { var createPlan = new createPlan(); batchRequest.addCreatePlan(createPlan); Assert.AreEqual(1, batchRequest.getNumCreatePlans()); mockCnpFile.Verify(cnpFile => cnpFile.createRandomFile(It.IsAny <string>(), It.IsAny <string>(), It.IsAny <string>(), mockCnpTime.Object)); mockCnpFile.Verify(cnpFile => cnpFile.AppendLineToFile(mockFilePath, createPlan.Serialize())); }
public void testCreatePlan() { var createPlan = new createPlan(); createPlan.planCode = "thePlanCode"; createPlan.name = "theName"; createPlan.intervalType = intervalType.ANNUAL; createPlan.amount = 100; var mockLitleResponse = new Mock<litleResponse>(); var mockLitleXmlSerializer = new Mock<litleXmlSerializer>(); mockXmlReader.SetupSequence(XmlReader => XmlReader.ReadOuterXml()) .Returns( "<createPlanResponse xmlns=\"http://www.litle.com/schema\"><litleTxnId>123</litleTxnId></createPlanResponse>") .Returns( "<createPlanResponse xmlns=\"http://www.litle.com/schema\"><litleTxnId>124</litleTxnId></createPlanResponse>"); var mockLitleBatchResponse = new batchResponse(); mockLitleBatchResponse.setCreatePlanResponseReader(mockXmlReader.Object); mockLitleResponse.Setup(litleResponse => litleResponse.nextBatchResponse()).Returns(mockLitleBatchResponse); var mockedLitleResponse = mockLitleResponse.Object; mockLitleXmlSerializer.Setup( litleXmlSerializer => litleXmlSerializer.DeserializeObjectFromString(It.IsAny<string>())) .Returns(mockedLitleResponse); var mockedCommunication = mockCommunications.Object; litle.setCommunication(mockedCommunication); var mockedLitleXmlSerializer = mockLitleXmlSerializer.Object; litle.setLitleXmlSerializer(mockedLitleXmlSerializer); var mockedLitleFile = mockLitleFile.Object; litle.setLitleFile(mockedLitleFile); litle.setLitleTime(mockLitleTime.Object); var litleBatchRequest = new batchRequest(_mockCache.Object); litleBatchRequest.setLitleFile(mockedLitleFile); litleBatchRequest.setLitleTime(mockLitleTime.Object); litleBatchRequest.addCreatePlan(createPlan); litleBatchRequest.addCreatePlan(createPlan); litle.addBatch(litleBatchRequest); var batchFileName = litle.sendToLitle(); var actualLitleResponse = litle.receiveFromLitle(batchFileName); var actualLitleBatchResponse = actualLitleResponse.nextBatchResponse(); Assert.AreSame(mockLitleBatchResponse, actualLitleBatchResponse); Assert.AreEqual("123", actualLitleBatchResponse.nextCreatePlanResponse().litleTxnId); Assert.AreEqual("124", actualLitleBatchResponse.nextCreatePlanResponse().litleTxnId); Assert.IsNull(actualLitleBatchResponse.nextCreatePlanResponse()); 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)); }