Esempio n. 1
0
        public void Mix()
        {
            var variable = new VariableHttpPathPart("key");
            var url      = new HttpUrlDescriptor("path/", variable, "/api").CreateUrl("http://localhost");

            url.Path["key"] = "to";
            Assert.AreEqual("http://localhost/path/to/api", url.ToString());
        }
Esempio n. 2
0
        public void VariableQueryTwoValues()
        {
            var variable = new VariableHttpPathPart("variable");
            var url      = new HttpUrlDescriptor(new KeyValuePair <string, HttpUrlPart>("key", variable)).CreateUrl("http://localhost");

            url.Query["variable"] = new[] { "value1", "value2" };
            Assert.AreEqual("http://localhost?key=value1&key=value2", url.ToString());
        }
Esempio n. 3
0
        public void Variable()
        {
            var variable = new VariableHttpPathPart("key");
            var url      = new HttpUrlDescriptor(variable).CreateUrl("http://localhost");

            url.Path["key"] = "foo";
            Assert.AreEqual("http://localhost/foo", url.ToString());
        }
Esempio n. 4
0
        public void FullUrl()
        {
            var variable1 = new VariableHttpPathPart("key1");
            var variable2 = new VariableHttpPathPart("variable2");
            var url       = new HttpUrlDescriptor(new[] { variable1 }, new[] { new KeyValuePair <string, HttpUrlPart>("key2", variable2) }).CreateUrl("http://localhost");

            url.Path["key1"]       = "value1";
            url.Query["variable2"] = new[] { "value2" };
            Assert.AreEqual("http://localhost/value1?key2=value2", url.ToString());
        }