Beispiel #1
0
        public void CreateURLObjectArray()
        {
            var url = UrlUtils.CreateUrl("http://test.com", new {
                key1 = new[] { "value1", "value2" },
            });

            Assert.Equal("http://test.com/?key1[]=value1&key1[]=value2", url);
        }
Beispiel #2
0
        public void CreateURLObject()
        {
            var url = UrlUtils.CreateUrl("http://test.com", new {
                key1 = "value1",
            });

            Assert.Equal("http://test.com/?key1=value1", url);
        }
Beispiel #3
0
        public void CreateURLKeyValuePairList()
        {
            var url = UrlUtils.CreateUrl("http://test.com", new List <KeyValuePair <string, string> > {
                new KeyValuePair <string, string>("key1", "value1")
            });

            Assert.Equal("http://test.com/?key1=value1", url);
        }
Beispiel #4
0
        public void CreateURLEscape()
        {
            var url = UrlUtils.CreateUrl("http://test.com", new Dictionary <string, string>()
            {
                ["key1"] = "value1 value2",
            });

            Assert.Equal("http://test.com/?key1=value1%20value2", url);
        }
Beispiel #5
0
        public void CreateURLDictionaryHttps()
        {
            var url = UrlUtils.CreateUrl("https://test.com", new Dictionary <string, string>()
            {
                ["key1"] = "value1",
            });

            Assert.Equal("https://test.com/?key1=value1", url);
        }
Beispiel #6
0
        public void CreateURLKeyValuePairListMultipleArray()
        {
            var url = UrlUtils.CreateUrl("http://test.com", new List <KeyValuePair <string, string> > {
                new KeyValuePair <string, string>("key1[]", "value1"),
                new KeyValuePair <string, string>("key1[]", "value2"),
            });

            Assert.Equal("http://test.com/?key1[]=value1&key1[]=value2", url);
        }
Beispiel #7
0
        public void ExtendUrlEscape()
        {
            var url = UrlUtils.CreateUrl("http://test.com", new Dictionary <string, string>()
            {
                ["key1"] = "value1 value2",
            });

            Assert.Equal("http://test.com/?key1=value1%20value2", url);

            url = UrlUtils.ExtendUrl(url, new Dictionary <string, string> {
                ["key2"] = "value2"
            });

            Assert.Equal("http://test.com/?key1=value1%20value2&key2=value2", url);

            url = UrlUtils.ExtendUrl(url, new Dictionary <string, string> {
                ["key1"] = "value1",
                ["key3"] = "value3",
            });

            Assert.Equal("http://test.com/?key1=value1&key2=value2&key3=value3", url);
        }
Beispiel #8
0
        public void CreateURLEmpty()
        {
            var url = UrlUtils.CreateUrl("http://test.com", (Dictionary <string, string>)null);

            Assert.Equal("http://test.com", url);
        }