Search code examples
c#unit-testingvisual-studio-2013resharper

Resharper Unit Tests not running


I'm trying to get started writing unit tests in a project. I wrote the createTest() method first and tried it. This test passed and I started writing my other tests.

Now all my tests just say "Test not run". This happens both when I try to run all tests at once and when I run a single test.

All I've found so far is people using NUnit. We're using the default Microsoft testing framework with ReSharper running the tests.

[TestMethod]
public void CreateTest()
{
    Init.Initialize();
    // set up
    UserModel user = new UserModel();

    user.Address = "Testing Street 1";
    user.Email = "[email protected]";
    user.Level = 2;
    user.Password = "test";
    user.RfiDnumber = "00d0wad0aw";
    user.Telephonenumber = "0638212327";
    user.Username = "testcaseuser";

    Assert.IsTrue(user.Create(), "Cannot write user to database");

    test_user = user;
}

[TestMethod]
public void ReadTest()
{
    Init.Initialize();
    // set up
    UserModel user = getTestUser();

    Assert.AreEqual(user.Email, test_user.Email, "Reading returned an unexpected result");
}

[TestMethod]
public void AlterTest()
{
    Init.Initialize();
    UserModel user = getTestUser();

    user.Email = "[email protected]";

    Assert.IsTrue(user.Update(), "Failure during updating");

    user.Read();

    Assert.AreNotEqual(user.Email, test_user.Email);
}

[TestMethod]
public void DestroyTest()
{
    Init.Initialize();
    UserModel user = getTestUser();

    Assert.IsTrue(user.Destroy(), "Could not destroy user");
}

The above tests will make ReSharper say "Test not run"

I just tried running the tests on my laptop. They worked without any changes to the code and the tests completed instantly. This leads me to think I'm dealing with a faulty config somewhere.


Solution

  • It seems there was a bad config /somewhere/. I reinstalled the entire sysetm, followed by VS2013 and R#. The tests now run fine.