Exemple #1
0
        public void TestIntList()
        {
            var listHolder = new IntListHolder()
            {
                List = new List <int>()
                {
                    1, 2, -3
                }
            };

            var result    = queryStringBuilder.CreateQueryString(listHolder);
            var valueList = QueryStringBuilderTestHelper.CreateValueListFromQueryString(result);

            Assert.IsTrue(result[0] == '?');
            Assert.IsTrue(valueList.Count == 3);

            var sourceIndex = 0;

            foreach (var item in valueList)
            {
                Assert.IsTrue(string.Equals(item[0], "List"));
                Assert.IsTrue(string.Equals(item[1], Uri.EscapeDataString(listHolder.List[sourceIndex].ToString(CultureInfo.InvariantCulture))));
                sourceIndex++;
            }
        }
Exemple #2
0
        public void TestNullList()
        {
            var listHolder = new IntListHolder();

            var result    = queryStringBuilder.CreateQueryString(listHolder);
            var valueList = QueryStringBuilderTestHelper.CreateValueListFromQueryString(result);

            Assert.IsTrue(string.IsNullOrEmpty(result));
            Assert.IsTrue(valueList.Count == 0);
        }