Esempio n. 1
0
        public void BuildQueryString_WithoutShortArraySerialization_ReturnsLongQueryString()
        {
            var actual = UriExtensions.BuildQueryString("", false, new Dictionary <string, object>
            {
                { "x", new [] { 1, 2, 3 } },
            });

            Assert.AreEqual("x=1&x=2&x=3", actual);
        }
Esempio n. 2
0
        public void BuildQueryString_WithShortArraySerialization_ReturnsShortQueryString()
        {
            var actual = UriExtensions.BuildQueryString("", true, new Dictionary <string, object>
            {
                { "x", new [] { 1, 2, 3 } },
            });

            Assert.AreEqual("x=1%2c2%2c3", actual);
        }
Esempio n. 3
0
        public void BuildQueryString_WithStringParameter_ReturnsFullParameter()
        {
            var actual = UriExtensions.BuildQueryString("", false, new Dictionary <string, object>
            {
                { "x", "string" },
            });

            Assert.AreEqual("x=string", actual);
        }
Esempio n. 4
0
        public void BuildQueryString_WithInitialQueryStringAndParameters_ReturnsBoth()
        {
            var actual = UriExtensions.BuildQueryString("a=4&b=5&c=6", false, new Dictionary <string, object>
            {
                { "x", 1 },
                { "y", 2 },
                { "z", 3 },
            });

            Assert.AreEqual("a=4&b=5&c=6&x=1&y=2&z=3", actual);
        }
Esempio n. 5
0
        public void BuildQueryString_WithNullParameter_IgnoresTheParameter()
        {
            var actual = UriExtensions.BuildQueryString("", false, new Dictionary <string, object>
            {
                { "x", 1 },
                { "y", null },
                { "z", 3 },
            });

            Assert.AreEqual("x=1&z=3", actual);
        }
Esempio n. 6
0
        public void BuildQueryString_WithEmptyInitialQueryString_ReturnsOnlyParameters()
        {
            var actual = UriExtensions.BuildQueryString("", false, new Dictionary <string, object>
            {
                { "x", 1 },
                { "y", 2 },
                { "z", 3 },
            });

            Assert.AreEqual("x=1&y=2&z=3", actual);
        }
Esempio n. 7
0
        public void BuildQueryString_WithEmptyParameters_ReturnsOnlyInitialQueryString()
        {
            var actual = UriExtensions.BuildQueryString("a=4&b=5&c=6", false, new Dictionary <string, object>());

            Assert.AreEqual("a=4&b=5&c=6", actual);
        }