Today I wrote a series of tests around a method that takes an input value and returns a different data array depending on whether this value passes (internal check), i.e.
[TestMethod]
public void IsValidForValueFour()
{
var result = myComponent.Validator(4);
Assert.IsTrue(result[0], "Blah");
}
The method Validator()basically searches in a (hard-coded) table stored confidentially in myComponent.
This was wrong. I have effectively tested the values in a private lookup table. Do I have to worry about the values that were being transmitted and exited? Should I test the length of the output array, not its contents? Or is it right to check for specific answers, given some input cost?
In short, what should be the intent behind the unit test as follows?
flesh source
share