unit testing - What is the difference between Classic and Constraint Model Assertions in Nunit? -


i learning nunit-2.6.3 reading documentation. having few doubts it.

what difference between classical model , constraint model assertion?

which model of assertions best one, , why?

the main difference syntactic. it's difference between (classic):

assert.areequal("expected", somestring); 

and (constraint)

assert.that(somestring, is.equalto("expected")); 

classic mode has been around longer , people believe it's more explicit , easier follow.

other people believe constraint based approach closer way might constraint if explaining else.

if you're getting started, constraint based assertions better ones learn, since they're direction nunit appears trying head in. they're closer fluentassertions. constraint based assertions has more explicit support extension through use of iresolveconstraint interface.

you should gain awareness of classic assertions since there's chance different places encounter code may use either depending on used first.

although syntax different, they're doing similar, if understand 1 set of assertions, converting them , forth pretty straightforward.


Comments

Popular posts from this blog

PHP DOM loadHTML() method unusual warning -

python - How to create jsonb index using GIN on SQLAlchemy? -

c# - TransactionScope not rolling back although no complete() is called -