test cases, "when", "what", "why"?
being new exam formed development, doubt bugging me. many too much? should tested, should tested, since should tested? examples given c# nunit, nonetheless i assume doubt itself libel agnostic.
here twin tide examples own, tests general list vigilant (being tested strings, initialisation duty adds 3 equipment {"foo", "bar", "baz"}):
[test]
public vacant countchanging()
{
assert.that(_list.count, is.equalto(3));
_list.add("qux");
assert.that(_list.count, is.equalto(4));
_list[7] = "quuuux";
assert.that(_list.count, is.equalto(8));
_list.remove("quuuux");
assert.that(_list.count, is.equalto(7));
}
[test]
public vacant containsitem()
{
assert.that(_list.contains("qux"), is.equalto(false));
_list.add("qux");
assert.that(_list.contains("qux"), is.equalto(true));
_list.remove("qux");
assert.that(_list.contains("qux"), is.equalto(false));
}
the formula sincerely self-commenting, i won't what's happening, nonetheless arrange thing holding too far? add() remove() tested seperately course, turn should i sorts tests? should i even have sorts tests?
Comments
Post a Comment