Esempio n. 1
0
        public void MakeURI_T2_params()
        {
            var pattern = new URIPattern("{year}/values?{p1}={v1}&par2={v2}");
            var map = new JSONDataMap { { "year", "1980" }, { "p1", "par1" }, { "v1", 10 }, { "v2", "val2" } };

            var uri = pattern.MakeURI(map);

            Assert.AreEqual(new Uri("1980/values?par1%3D10%26par2%3Dval2", UriKind.RelativeOrAbsolute), uri);
        }
Esempio n. 2
0
        public void MakeURI_T1_noprefix()
        {
            var pattern = new URIPattern("/news/{year}/{month}/{title}");
            var map = new JSONDataMap { { "year", "1981" }, { "month", 12 }, { "title", "some_title" } };

            var uri = pattern.MakeURI(map);

            Assert.AreEqual(new Uri("/news/1981/12/some_title", UriKind.RelativeOrAbsolute), uri);
        }
Esempio n. 3
0
        public void MakeURI_T1_prefix()
        {
            var pattern = new URIPattern("{year}/{month}/{title}");
            var prefix = new Uri("http://test.com");
            var map = new JSONDataMap { { "year", "1981" }, { "month", 12 }, { "title", "some_title" } };

            var uri = pattern.MakeURI(map, prefix);

            Assert.AreEqual(new Uri(prefix, "http://test.com/1981/12/some_title"), uri);
        }
Esempio n. 4
0
        private void button3_Click(object sender, EventArgs e)
        {
            var pat = new URIPattern(tbPattern.Text);

              var uri = new Uri("http://localhost:8080/cities/cleveland.htm?port=true&law=%2e%2d%56");

            //  MessageBox.Show(pat._____Chunks);

              var nu = pat.MakeURI(new Dictionary<string, object>
                  {
                     {"city", "Hamburg"},
                     {"state", "Ohio"}
                  }, new Uri("http://test.com"));

              MessageBox.Show(nu.ToString());

             // Text = pat.MatchURI( uri )["city"].ToString();
        }