Note: I am using TestDriven.NET 3.0.2749 and NUnit 2.6.0.12051 for this project.
I have installed both TestDriven.NET and NUnit and am trying to get TestDriven.NET to run all tests in a test class via the right-click context menu.
From the TestDriven.NET documentation:
If the code editor window is selected, the test(s) to execute will be determined by the position of the caret; individual tests are executed by right-clicking anywhere inside a test method and selecting 'Run Test(s)' as shown in Figure 2; all tests in a test fixture are executed by right-clicking inside a class (but outside of any method) and selecting 'Run Test(s)'; all tests in a namespace are executed by right-clicking inside a namespace and selecting 'Run Test(s)'.
I can successfully run a specific test method using the right-click context menu and the NUnit GUI runner will successfully run all test for a given class, but I would like to use the quick access TestDriven.NET provides for this tasks while I'm developing.
I receive the follow error when I place the caret outside of test method:
The target type doesn't contain tests from a known test framework or a 'Main' method.
Updated 1: Added example code.
Example code to test:
namespace TDDN.Framework
{
public class ExampleClass
{
public ExampleClass() { }
public Int32 Add(Int32 x, Int32 y)
{
return x + y;
}
public Int32 Subtract(Int32 x, Int32 y)
{
return x - y;
}
}
}
Unit tests:
using NUnit.Framework;
using TDDN.Framework;
namespace TDDN.UnitTests
{
[TestFixture] // Cursor caret placed here results in error above.
public class ExampleClassTests
{
[Test] // Cursor caret placed here works.
public void Add_SumTwoIntegers_SumReturned()
{
ExampleClass exampleClass = new ExampleClass();
Assert.AreEqual(10, exampleClass.Add(5, 5));
}
[Test] // Cursor caret placed here works also.
public void Subtract_SubtractTwoIntegers_DifferenceReturned()
{
ExampleClass exampleClass = new ExampleClass();
Assert.AreEqual(5, exampleClass.Subtract(10, 5));
}
}
}