Exemple #1
0
        public updatePlanResponse UpdatePlan(updatePlan updatePlan)
        {
            litleOnlineRequest request = createLitleOnlineRequest();

            request.updatePlan = updatePlan;

            litleOnlineResponse response           = sendToLitle(request);
            updatePlanResponse  updatePlanResponse = response.updatePlanResponse;

            return(updatePlanResponse);
        }
Exemple #2
0
        public void TestUpdatePlan()
        {
            updatePlan updatePlan = new updatePlan();

            updatePlan.planCode = "theCode";

            var mock = new Mock <Communications>();

            mock.Setup(Communications => Communications.HttpPost(It.IsRegex(".*?<cnpOnlineRequest.*?<updatePlan.*?<planCode>theCode</planCode>.*?</updatePlan>.*?", RegexOptions.Singleline), It.IsAny <Dictionary <String, String> >()))
            .Returns("<cnpOnlineResponse version='8.21' response='0' message='Valid Format' xmlns='http://www.vantivcnp.com/schema'><updatePlanResponse><planCode>theCode</planCode></updatePlanResponse></cnpOnlineResponse>");

            Communications mockedCommunication = mock.Object;

            cnp.SetCommunication(mockedCommunication);
            updatePlanResponse updatePlanResponse = cnp.UpdatePlan(updatePlan);

            Assert.AreEqual("theCode", updatePlanResponse.planCode);
        }
        public void TestUpdatePlanResponse()
        {
            String             xml                = @"
<updatePlanResponse 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>
</updatePlanResponse>";
            XmlSerializer      serializer         = new XmlSerializer(typeof(updatePlanResponse));
            StringReader       reader             = new StringReader(xml);
            updatePlanResponse updatePlanResponse = (updatePlanResponse)serializer.Deserialize(reader);

            Assert.AreEqual("1", updatePlanResponse.cnpTxnId);
            Assert.AreEqual("000", updatePlanResponse.response);
            Assert.AreEqual("Approved", updatePlanResponse.message);
            Assert.AreEqual(new DateTime(2013, 9, 5, 14, 23, 45), updatePlanResponse.responseTime);
            Assert.AreEqual("thePlan", updatePlanResponse.planCode);
        }