c# - Nunit runsTestCase with a TestCaseSource with the first iteration having no parameters? Why? -
hi new nunit , passing series of objects testcase testcasesource. reason though nunit seems run test first no parameters passed results in ignored output:
the test:
private readonly object[] _nunitisweird = { new object[] {new list<string>{"one", "two", "three"}, 3}, new object[] {new list<string>{"one", "two"}, 2} }; [testcase, testcasesource("_nunitisweird")] public void thecountsarecorrect(list<string> entries, int expectedcount) { assert.areequal(expectedcount,calculations.countthese(entries)); }
thecountsarecorrect (3 tests), failed: 1 or more child tests had errors thecountsarecorrect(), ignored: no arguments provided thecountsarecorrect(system.collections.generic.list
1[system.string],2), success thecountsarecorrect(system.collections.generic.list
1[system.string],3), success
so first test ignored because there no parameters, don't want test run, ever, makes no sense , it's mucking test output. tried ignoring , sets test output correctly comes when run tests again.
is there missing, have looked everywhere.
testcase
, testcasesource
2 different things. need remove testcase
attribute.
[testcasesource("_nunitisweird")] public void thecountsarecorrect(list<string> entries, int expectedcount) { assert.areequal(expectedcount,calculations.countthese(entries)); }
the testcase attribute supplying inline data, nunit attempting supply no parameters test, failing. it's processing testcasesource attribute, , looking data supplies , trying pass test well, working correctly.
as side note, strictly speaking, docs suggest should mark testcasesource
test test
attribute below, i've never found necessary:
[test, testcasesource("_nunitisweird")] public void thecountsarecorrect(list<string> entries, int expectedcount)
Comments
Post a Comment