I have a test class and below I have posted a sample test from the test class
namespace AdminPortal.Tests.Controller_Test.Customer
{
[TestClass]
public class BusinessUnitControllerTests
{
private IBusinessUnitRepository _mockBusinessUnitRepository;
private BusinessUnitController _controller;
[TestInitialize]
public void TestInitialize()
{
_mockBusinessUnitRepository = MockRepository.GenerateMock<IBusinessUnitRepository>();
_controller = new BusinessUnitController(_mockBusinessUnitRepository);
}
[TestCleanup]
public void TestCleanup()
{
_mockBusinessUnitRepository = null;
_controller.Dispose();
_controller = null;
}
#region Index Action Tests
[TestMethod]
public void Index_Action_Calls_GetAllBusinessUnit()
{
_mockBusinessUnitRepository.Stub(x => x.GetAllBusinessUnit());
_controller.Index();
_mockBusinessUnitRepository.AssertWasCalled(x=>x.GetAllBusinessUnit());
}
}
}
When I run the project I get following screen
I checked the references and the test project has the reference to main project.
Any idea why the test are not running or saying that they were inconclusive?
Edit 1:
I saw a post here and changed my test’s setting’s default processor architecture to X64 but it still doesn’t work.
54 Answers
Just in case none of the above options worked for anyone I fixed my instance of this error by noticing a corrupt entry in my App.Config due to a missing nuget package in the test project.