Пример #1
0
        public void GetUriParameters_NoParameters_ReturnsEmptyDictionary()
        {
            Uri uri = new Uri("http://www.google.de");
            Dictionary <string, string> parameters = UriUtils.GetUriParameters(uri);

            Assert.NotNull(parameters);
            Assert.AreEqual(0, parameters.Count);
        }
Пример #2
0
        public void GetUriParameters_OneParameter_DictionaryContainsKeyValuePair()
        {
            Uri uri = new Uri("http://www.google.de?param=test");
            Dictionary <string, string> parameters = UriUtils.GetUriParameters(uri);

            Assert.IsTrue(parameters.ContainsKey("param"));
            string retrieved = parameters["param"];

            Assert.AreEqual("test", retrieved);
        }
Пример #3
0
        public void GetUriParameters_MultipleParameters_DictionaryContainsKeyValuePairs()
        {
            Uri uri = new Uri("http://www.google.de?param=test&number=1");
            Dictionary <string, string> parameters = UriUtils.GetUriParameters(uri);

            Assert.AreEqual(2, parameters.Count);

            Assert.IsTrue(parameters.ContainsKey("param"));
            string retrieved = parameters["param"];

            Assert.AreEqual("test", retrieved);
            Assert.IsTrue(parameters.ContainsKey("number"));
            retrieved = parameters["number"];
            Assert.AreEqual("1", retrieved);
        }