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

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

vowpalwabbit - Interpreting Vowpal Wabbit results: Why are some lines appended by "h"? -

Is there a way to convert an HTML page styled with Bootstrap CSS into email-compatible html? -