c# - Does it make sense to unit test for a not existing Id -


does make sense pass not existing unique id getxx method expect created list without count? mean, when test existing id list created independent of number of items holds. why should list null or have no count == 0 if pass not existing id? not sure sense of test.

[test] public void get_teststeps_by_unitid_not_existing() {     // arrange     iteststepdataprovider provider = new teststepdataprovider(_connectionstring);     int unitid = 100;      // act     list<teststep> units = provider.getteststepsbyunitid(unitid);      // assert     assert.isnotnull(units);     assert.count(0, units); } 

this depend on system under test, supposed , how defined. example if defined method testing should never return null values empty collections given input (such non existing ids - whatever means) makes perfect sense test case , correct behavior of method.


Comments

Popular posts from this blog

jasper reports - Fixed header in Excel using JasperReports -

media player - Android: mediaplayer went away with unhandled events -

python - ('The SQL contains 0 parameter markers, but 50 parameters were supplied', 'HY000') or TypeError: 'tuple' object is not callable -