Reputation: 3896
Trying to create unit tests for my methods and can't seem to get the configuration right. I go New Test -> Unit Test Wizard -> Pick my method -> fill in test method values but I always get Assert.Inconclusive failed. Verify the correctness of this test method.
Here is a sample method:
namespace ConsoleApplication
{
class Program
{
static void Main(string[] args)
{
}
public int Mult(int a, int b)
{
return a * b;
}
}
}
and the test method:
[TestMethod()]
public void MultTest()
{
Program target = new Program(); // TODO: Initialize to an appropriate value
int a = 4; // TODO: Initialize to an appropriate value
int b = 5; // TODO: Initialize to an appropriate value
int expected = 20; // TODO: Initialize to an appropriate value
int actual;
actual = target.Mult(a, b);
Assert.AreEqual(expected, actual);
Assert.Inconclusive("Verify the correctness of this test method.");
}
Seems straight forward enough, but am I missing something trivial?
Upvotes: 3
Views: 1042
Reputation: 2293
sure you do :
Assert.Inconclusive("Verify the correctness of this test method.");
Your test says inconclusive therfore the result of the test is inconclusive.. You should use this syntax "Assert.Inconclusive" only to cover edge cases you are really aware of.
AFAIC, I never use it.
Upvotes: 1
Reputation: 14672
The Assert.Inconclusive is mainly a marker to tell you that you need to right your own verification steps for the test method. In other words, for what you are doing it can be removed as you have added your own Assertion.
It could also be used, if there is some logic in your test that prevents the full running of your test. So, if, for example, you couldn't create the object you were trying to test for some reason.
Upvotes: 3