static void Main()
    {
        var response = new MessagingResponse();
        var message  = new Message();

        message.Body("Hello World!");
        response.Message(message);
        response.Redirect(url: "https://demo.twilio.com/sms/welcome");

        System.Console.WriteLine(response.ToString());
    }
    static void Main()
    {
        var response = new MessagingResponse();
        var message  = new Message();

        message.Body("Hello World!");
        response.Append(message);
        response.Redirect(url: new Uri("https://demo.twilio.com/welcome/sms/"));

        Console.WriteLine(response.ToString());
    }
Ejemplo n.º 3
0
        public ActionResult Index()
        {
            var response = new MessagingResponse();
            var message  = new Message();

            message.Body("Hello World!");
            response.Append(message);
            response.Redirect(url: new Uri("https://demo.twilio.com/welcome/sms/"));

            return(View(response));
        }
Ejemplo n.º 4
0
        public void TestRedirect()
        {
            var mr = new MessagingResponse();

            mr.Redirect(method: "GET", url: "http://www.twilio.com");

            Assert.AreEqual(
                mr.ToString(),
                "<?xml version=\"1.0\" encoding=\"utf-8\"?>" + Environment.NewLine +
                "<Response>" + Environment.NewLine +
                "  <Redirect method=\"GET\">http://www.twilio.com</Redirect>" + Environment.NewLine +
                "</Response>"
                );
        }
Ejemplo n.º 5
0
        public void TestElementWithChildren()
        {
            var elem = new MessagingResponse();

            elem.Message("body", "to", "from", new Uri("https://example.com"), Twilio.Http.HttpMethod.Get);

            elem.Redirect(new Uri("https://example.com"), Twilio.Http.HttpMethod.Get);

            Assert.AreEqual(
                "<?xml version=\"1.0\" encoding=\"utf-8\"?>" + Environment.NewLine +
                "<Response>" + Environment.NewLine +
                "  <Message to=\"to\" from=\"from\" action=\"https://example.com\" method=\"GET\">body</Message>" + Environment.NewLine +
                "  <Redirect method=\"GET\">https://example.com</Redirect>" + Environment.NewLine +
                "</Response>",
                elem.ToString()
                );
        }