public createPlanResponse CreatePlan(createPlan createPlan) { litleOnlineRequest request = createLitleOnlineRequest(); request.createPlan = createPlan; litleOnlineResponse response = sendToLitle(request); createPlanResponse createPlanResponse = response.createPlanResponse; return(createPlanResponse); }
public void TestCreatePlan() { createPlan createPlan = new createPlan(); createPlan.planCode = "theCode"; var mock = new Mock <Communications>(); mock.Setup(Communications => Communications.HttpPost(It.IsRegex(".*?<cnpOnlineRequest.*?<createPlan.*?<planCode>theCode</planCode>.*?</createPlan>.*?", RegexOptions.Singleline), It.IsAny <Dictionary <String, String> >())) .Returns("<cnpOnlineResponse version='8.21' response='0' message='Valid Format' xmlns='http://www.vantivcnp.com/schema'><createPlanResponse><planCode>theCode</planCode></createPlanResponse></cnpOnlineResponse>"); Communications mockedCommunication = mock.Object; cnp.SetCommunication(mockedCommunication); createPlanResponse createPlanResponse = cnp.CreatePlan(createPlan); Assert.AreEqual("theCode", createPlanResponse.planCode); }
public void TestCreatePlanResponse() { String xml = @" <createPlanResponse xmlns=""http://www.vantivcnp.com/schema""> <cnpTxnId>1</cnpTxnId> <response>000</response> <message>Approved</message> <responseTime>2013-09-05T14:23:45</responseTime> <planCode>thePlan</planCode> </createPlanResponse>"; XmlSerializer serializer = new XmlSerializer(typeof(createPlanResponse)); StringReader reader = new StringReader(xml); createPlanResponse createPlanResponse = (createPlanResponse)serializer.Deserialize(reader); Assert.AreEqual("1", createPlanResponse.cnpTxnId); Assert.AreEqual("000", createPlanResponse.response); Assert.AreEqual("Approved", createPlanResponse.message); Assert.AreEqual(new DateTime(2013, 9, 5, 14, 23, 45), createPlanResponse.responseTime); Assert.AreEqual("thePlan", createPlanResponse.planCode); }