Beispiel #1
0
        private void TestParameters()
        {
            var collection = new KeyValueCollection();

            UriParser.ParseParameters(collection, new StringReader(";welcome;lr=true"));
            Assert.Equal(string.Empty, collection["welcome"]);
            Assert.Equal("true", collection["lr"]);

            collection.Clear();
            UriParser.ParseParameters(collection, new StringReader(";welcome"));
            Assert.Equal(string.Empty, collection["welcome"]);

            collection.Clear();
            UriParser.ParseParameters(collection, new StringReader(";welcome;"));
            Assert.Equal(string.Empty, collection["welcome"]);

            collection.Clear();
            UriParser.ParseParameters(collection, new StringReader(";welcome=world"));
            Assert.Equal("world", collection["welcome"]);

            collection.Clear();
            UriParser.ParseParameters(collection, new StringReader(";welcome=world;"));
            Assert.Equal("world", collection["welcome"]);

            collection.Clear();
            UriParser.ParseParameters(collection, new StringReader(";welcome=world;yes"));
            Assert.Equal("world", collection["welcome"]);
            Assert.Equal(string.Empty, collection["yes"]);

            collection.Clear();
            UriParser.ParseParameters(collection, new StringReader(";welcome=world;yes;"));
            Assert.Equal("world", collection["welcome"]);
            Assert.Equal(string.Empty, collection["yes"]);
        }