nunit - Using a delegate twice inside of a unit test -



nunit - Using a delegate twice inside of a unit test -

i have unit tests i’m using doesnotthrow feature of nunit. until recently, wasn’t concerned w/ actual response coming back. however, needed add together check count on result set. have redundant phone call in code. can clean , create utilize of delegate within sec assert call?

assert.doesnotthrow(() => new getmycollection.getcollection(request)); var response = new getmycollection().getcollection(request); assert.greater(response.mycount, 0);

just rid of first line entirely:

var response = new getmycollection().getcollection(request); assert.greater(response.mycount, 0);

if new getmycollection().getcollection(request) throws exception, create test fail anyway.

assert.doesnotthrow relatively pointless, imo - utilize contrast assert.throws calls.

delegates nunit

Comments

Popular posts from this blog

javascript - THREE.js reposition vertices for RingGeometry -

javascript - I need to update the text of a paragraph by inline edit -

assembly - What is the addressing mode for ld, add, and rjmp instructions? -