MVC4 bug in Area registration


public class AreaTests : RouteTestsBase
    private RouteTester<AdminAreaRegistration> tester;

    public void PrepareRoutes()
        tester = new RouteTester<AdminAreaRegistration>();

    // Test methods snipped

Generates the following exception
Initialization method IndividualTT.Web.Tests.AreaTests.PrepareRoutes threw exception. System.ArgumentException: System.ArgumentException: The class supplied to the generic constructor must inherit from either HttpApplication or AreaRegistration..

However the area registration code is inheriting from the AreaRegistration class
public class AdminAreaRegistration : AreaRegistration
    public override string AreaName
            return "Admin";

    public override void RegisterArea(AreaRegistrationContext context)
            new { action = "Index", id = UrlParameter.Optional }


manzo wrote Oct 18, 2012 at 11:32 AM

I've fixed this issue in a fork: http://mvcrouteunittester.codeplex.com/SourceControl/network/forks/manzo/MVC4

Uses the new RouteConfig class that MVC 4 introduced instead of the RegisterRoutes method in Global.asax.

manzo wrote Oct 18, 2012 at 1:21 PM

Apologies, I committed the incorrect version of this. I've now updated the code, and it should work correctly.