public void GetRouteData () { var r = new DynamicDataRoute ("{table}/{action}.aspx"); // We need one which overloads CreateHandler r.RouteHandler = new MyDynamicDataRouteHandler (); var wrapper = new MyHttpContextWrapper (); var request = wrapper.Request as MyHttpRequestWrapper; request.SetProperty ("AppRelativeCurrentExecutionFilePath", "~/NoSuchTable/List.aspx"); request.SetProperty ("PathInfo", String.Empty); // This must be non-null because DynamicData doesn't care to check whether the returned // value is null or not... request.SetProperty ("QueryString", new NameValueCollection ()); // It appears .NET checks whether the indicated table exists - if not, GetRouteData will return // null (even though the Route class will find a match) RouteData rd = r.GetRouteData (wrapper); Assert.IsNull (rd, "#A1"); request.SetProperty ("AppRelativeCurrentExecutionFilePath", "~/BazTable/List.aspx"); rd = r.GetRouteData (wrapper); Assert.IsNotNull (rd, "#B1"); }