コード例 #1
0
        public void ShouldGetRouteInformation()
        {
            RouteValueDictionary expected = new RouteValueDictionary(new {
                controller = "Artists",
                action = "List",
                genre = "All"
            });

            RouteInformation ri = new RouteInformation("~/Artists", RegisterRoutes);

            Assert.AreEqual("~/Artists", ri.Url);
            Assert.IsTrue(ri.Valid);
            Assert.AreEqual("Artists", ri.Controller);
            Assert.AreEqual("List", ri.Action);
            Assert.IsTrue(ri.IsActionOnController("Artists"));
            Assert.IsTrue(ri.IsActionOnController("ArtistsController"));
            RoutingAssert.AreDictionariesEqual(expected, ri.RouteValues);
        }
コード例 #2
0
        public void ShouldNotGetRouteInformationForNonExistentRoute()
        {
            RouteInformation ri = new RouteInformation("/Invalid", RegisterRoutes);

            Assert.IsFalse(ri.Valid);
        }
コード例 #3
0
        public void ShouldNotGetRouteInformationForAbsoluteRoute()
        {
            RouteInformation ri = new RouteInformation("http://localhost/Artists", RegisterRoutes);

            Assert.IsFalse(ri.Valid);
        }
コード例 #4
0
        public void ShouldNotGetAuthoriseRequired()
        {
            RouteInformation ri = new RouteInformation("/Test", RegisterRoutes);

            Assert.IsFalse(ri.DoesActionRequireAuthorisation());
        }
コード例 #5
0
        public void ShouldGetAuthorizeRequired()
        {
            RouteInformation ri = new RouteInformation("/Artists", RegisterRoutes);

            Assert.IsTrue(ri.DoesActionRequireAuthorisation());
        }
コード例 #6
0
        public void ShouldProperlyFormatUrl2()
        {
            RouteInformation ri = new RouteInformation("Artists", RegisterRoutes);

            Assert.AreEqual("Artists", ri.Url);
        }
コード例 #7
0
        public void ShouldNotGetRouteInformationForNullUrl()
        {
            RouteInformation ri = new RouteInformation("", RegisterRoutes);

            Assert.IsFalse(ri.Valid);
        }