I have a simple solution where I put in a c# class library project, and referenced nunit dll etc.
I created a .cs file, added [testfixture] and a simple [test]
If I go to Test -> Run -> Test in current context (or even all in solution)
I get the error:
No tests were run b/c no tests are loaded or the selected tests are disabled.
I did compile the project.
SomeTest.cs
using System.Collections.Generic;
using System.Linq;
using System.Text;
using NUnit.Framework;
[TestFixture]
public class SomeTest
{
[Test]
public void Test1()
{
Assert.AreEqual(1, 1);
}
}
If you do require nUnit, try looking here
I figured out the problem. The problem is that you have added the test project as a class library. There is a template available with VisualStudio that goes ‘Test Project’ that creates a test project. But I am guessing that it does something behind the screens to enable you to run the tests from Visual studio. I verified this by creating two projects – one of type Test Project and one of type Class Library.
I had the same test class in both projects, but I was able to run the test only in the ‘Test Project’. But this worked only for Microsoft’s inbuilt unit testing framework. Nunit doesn’t seem to work still(even if you create a test project and add a nunit test there).
You could try VisualNUnit, which is a test runner for Visual Studio 2010.