I am trying to get unit tests to run successfully for my MVC 4 Web Application project.
When I run the tests classes individually all of the tests pass, when I come to run all test in solution only 2/9 pass, I have clicked Debug Checked Tests and they all pass when I the hit run again they also all pass.
This problem is also being replicated when I check the project into TFS, I have setup continuous integration they project builds, runs the tests and fails on exactly the same tests.
The error I'm getting back is *"A route named '' is already in the route collection"
Does anybody have any ideas why this might be happening?
In each class I have a [TestInitialize] block which is shown below:
[TestInitialize]
public void Setup()
{
var builder = new TestControllerBuilder();
controller = new MyController();
builder.InitializeController(controller);
RouteConfig.RegisterRoutes(RouteTable.Routes);
}
I had a similar error in the classes when I hadn't included the TestControllerBuilder, could it be that this code is not running correctly?