//arrange
RouteCollection routes = new RouteCollection();
MvcApplication.RegisterRoutes(routes);
var httpContextMock = new Mock<HttpContextBase>();
httpContextMock.Expect(c => c.Request.AppRelativeCurrentExecutionFilePath).Return("~/product/list");
//act
RouteData routeData = routes.GetRouteData(httpContextMock.Object);
//assert
Assert.IsNotNull(routeData, "Should have found the route");
Assert.AreEqual("product", routeData.Value["Controller"]);
Assert.AreEqual("list", routeData.Value["action"]);
Assert.AreEqual("", routeData.Values["id"]);
Tuesday, June 23, 2009
Test asp.net mvc route
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment