コード例 #1
0
        public async Task ShouldConvertArrayToUri()
        {
            // arrange
            const string baseUrl     = "http://localhost";
            QueryString  queryString = new QueryString();
            var          values      = new int[] { 1, 2, 3 };

            // act
            foreach (var v in values)
            {
                queryString.Add("key1", v.ToString());
            }
            queryString.Add("key2", "value2");
            Uri uri = await queryString.AsUriAsync(baseUrl);

            // assert
            Assert.NotNull(uri);
            Assert.True(uri.ToString() == "http://localhost/?key1=1&key1=2&key1=3&key2=value2");
        }