Created
June 11, 2013 14:53
-
-
Save bitsprint/5757525 to your computer and use it in GitHub Desktop.
Area Registration Default Route Tests
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [Test] | |
| public void RegisterArea_RoutesToArea() | |
| { | |
| var routes = new RouteCollection(); | |
| var areaRegistration = new FooAreaRegistration(); | |
| Assert.AreEqual("Foo", areaRegistration.AreaName); | |
| var areaRegistrationContext = new AreaRegistrationContext(areaRegistration.AreaName, routes); | |
| areaRegistration.RegisterArea(areaRegistrationContext); | |
| var context = new Mock<HttpContextBase>(); | |
| context.Setup(c => c.Request.AppRelativeCurrentExecutionFilePath).Returns("~/Foo/Dashboard"); | |
| var routeData = routes.GetRouteData(context.Object); | |
| Assert.IsNotNull(routeData, "Should have found the route"); | |
| Assert.AreEqual("Foo", routeData.DataTokens["area"]); | |
| Assert.AreEqual("Dashboard", routeData.Values["controller"]); | |
| Assert.AreEqual("Index", routeData.Values["action"]); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment