Пример #1
0
        public void testCreatePlan()
        {
            createPlan createPlan = new createPlan();

            createPlan.planCode = "theCode";

            var mock = new Mock <Communications>();

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

            Communications mockedCommunication = mock.Object;

            litle.setCommunication(mockedCommunication);
            createPlanResponse createPlanResponse = litle.CreatePlan(createPlan);

            Assert.AreEqual("theCode", createPlanResponse.planCode);
        }