Exemplo n.º 1
0
        public void CheckVariableValues()
        {
            SharkPath path = new SharkPath("/root/{str:string}/{i:int}");
            Dictionary <string, object> values = path.ParseRoute("/root/astring/1234");

            Assert.Equal(values.Count, 2);

            Assert.True(values.ContainsKey("str"));
            Assert.Equal(values["str"].GetType(), typeof(string));
            Assert.Equal((string)values["str"], "astring");

            Assert.True(values.ContainsKey("i"));
            Assert.Equal(values["i"].GetType(), typeof(int));
            Assert.Equal((int)values["i"], 1234);
        }
Exemplo n.º 2
0
        public void DuplicateVariables()
        {
            SharkPath path = new SharkPath("/{var1:int}/{var1:int}");

            Assert.Throws <ArgumentException>(() => path.ParseRoute("/1/2"));
        }