jtpereyda
jtpereyda

Reputation: 7395

NUnit Inconclusive

The following trivial TestFixture is giving an inconclusive result. Why?

[TestFixture]
internal class SomeTest
{
   [TestCase]
   void myTest()
   {
      Assert.AreEqual(3,3);
   }
}

Upvotes: 2

Views: 2020

Answers (3)

Rashmin Javiya
Rashmin Javiya

Reputation: 5222

In my case, TestCaseSource had different number of argument than the parameter in test method.

[Test, TestCaseSource("DivideCases")]
public void DivideTest(int n, int d, int q)
{
    Assert.AreEqual( q, n / d );
}

static object[] DivideCases =
{
    new object[] { 12, 3 },
    new object[] { 12, 2 },
    new object[] { 12, 4 } 
};

Here each object array in DivideCases has two item which should be 3 as DivideTest method has 3 parameter.

Upvotes: 0

Twisted Mentat
Twisted Mentat

Reputation: 432

Yup, the test methods have got to be public as per the nUnit documentation. How else is nUnit going to find your tests. ;)

http://www.nunit.org/index.php?p=test&r=2.2.1

The signature for a test method is defined as follows:

    public void MethodName()

Upvotes: 1

jtpereyda
jtpereyda

Reputation: 7395

Test case methods need to be public (apparently):

internal class SomeTest
{
   [TestCase]
   public void myTest() //works now
   {
      Assert.AreEqual(3,3);
   }
}

Upvotes: 6

Related Questions