0 Comments
When you are unit testing in ASP.NET MVC problems will occur when you don't use the FixtureSetup method. When you run 'all tests' and only the first test will pass, you will have to use a base class.

The error looks like:
'A route named 'XXXX' is already in the route collection. Route names must be unique.'

For example you can use this empty class and have your test class inheriting this base class:

using NUnit.Framework;

namespace MyNameSpace
{

    [TestFixture]
    public class BaseFixture
    {

          [TestFixtureSetUp]
          public void FixtureSetup()
          {

          }

          [TestFixtureTearDown]
          public void FixtureTearDown()
          {

          }

          [SetUp]
          public void SetupTest()
          {

          }

          [TearDown]
          public void TeardownTest()
          {

          }

     }

}

Post comment