예제 #1
0
        public void RedwoodRoute_IsMatch_UrlTwoParametersBothRequired_NoMatchWhenOneSpecified()
        {
            var route = new RedwoodRoute("Article/{Id}/{Title}", null, null);

            IDictionary<string, object> parameters;
            var result = route.IsMatch("Article/15", out parameters);

            Assert.IsFalse(result);
        }
예제 #2
0
        public void RedwoodRoute_IsMatch_UrlTwoParametersBothRequired_DifferentPart()
        {
            var route = new RedwoodRoute("Article/id_{Id}/{Title}", null, null);

            IDictionary<string, object> parameters;
            var result = route.IsMatch("Articles/id_15", out parameters);

            Assert.IsFalse(result);
        }
예제 #3
0
        public void RedwoodRoute_IsMatch_EmptyRouteMatchesEmptyUrl()
        {
            var route = new RedwoodRoute("", null, null);

            IDictionary<string, object> parameters;
            var result = route.IsMatch("", out parameters);

            Assert.IsTrue(result);
        }
예제 #4
0
        public void RedwoodRoute_IsMatch_UrlTwoParametersBothRequired_BothSpecified()
        {
            var route = new RedwoodRoute("Article/id_{Id}/{Title}", null, null);

            IDictionary<string, object> parameters;
            var result = route.IsMatch("Article/id_15/test", out parameters);

            Assert.IsTrue(result);
            Assert.AreEqual(2, parameters.Count);
            Assert.AreEqual("15", parameters["Id"]);
            Assert.AreEqual("test", parameters["Title"]);
        }
예제 #5
0
        public void RedwoodRoute_IsMatch_UrlWithoutParametersNoMatch()
        {
            var route = new RedwoodRoute("Hello/Test/Page.txt", null, null);

            IDictionary<string, object> parameters;
            var result = route.IsMatch("Hello/Test/Page", out parameters);

            Assert.IsFalse(result);
        }
예제 #6
0
        public void RedwoodRoute_IsMatch_UrlTwoParametersOneSpecifiedOneDefault()
        {
            var route = new RedwoodRoute("Article/{Id}/{Title}", new { Title = "test" }, null);

            IDictionary<string, object> parameters;
            var result = route.IsMatch("Article/15", out parameters);

            Assert.IsTrue(result);
            Assert.AreEqual(2, parameters.Count);
            Assert.AreEqual("15", parameters["Id"]);
            Assert.AreEqual("test", parameters["Title"]);
        }