So’ I’m getting in Unit Testing. I created a really simple Function to test it.
public int MultiplyByFive(int x)
{
return x * 5;
}
The Test Method contains
[TestMethod()]
[DeploymentItem("UnitTestApp.exe")]
public void MultiplyByFiveTest()
{
Program_Accessor target = new Program_Accessor(); // TODO: Initialize to an appropriate value
int x = 5; // TODO: Initialize to an appropriate value
int expected = 25; // TODO: Initialize to an appropriate value
int actual;
actual = target.MultiplyByFive(x);
Assert.AreEqual(expected, actual);
Assert.Inconclusive("Verify the correctness of this test method.");
}
But when I run the test it returns:
nunit http://dl.getdropbox.com/u/357576/nunit.jpg
“Assert.Inconclusive failed. Verify the correctness of this test method.”
So what I’m doing wrong? thanks!
NUnit 2.5 added “inconclusive” as a result state in between success and failure. It’s explained in the release notes here.
NUnit is doing exactly what you told it to do. The new inconclusive state does terminate the test. If you want a message displayed in the case of your Assert failing, Assert.AreEqual() has an overload that takes a message string. Use that, and remove Assert.Inconclusive().