Test method is inconclusive: Test wasn't run. Error?
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.
Solution 1:
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.
Solution 2:
For me it was rather frustrating, but I've found solution for my case at least:
If your TestMethod is async, it cannot be void. It MUST return Task.
Hope it helps someone :)
Solution 3:
I had the same issue with resharper and I corrected this error by changing an option:
Resharper => Options => Tools => Unit Testing
I just had to uncheck the option "Shadow-copy assemblies being tested"
Solution 4:
It was a Resharper issue. In Resharper options->Tools->MSTEST, I unchecked the Use Legacy Runner and now it works.
Solution 5:
For me, simply cleaning and rebuilding the solution fixed it.