views:

199

answers:

2

I was just reading through the Nunit 2.5 docs and came across the [Theory attribute], and I'm having a little bit trouble understanding how this is different to a normal unit test and how it could be used.

What makes it different from a normal test?

What situations would you use this kind of test?

I just can't seem to get my head around it :(

+4  A: 

A Theory is similar to a parameterized test, with the additional ability to define assumptions under which it must pass, which are checked before actually performing the test and its assertions.

Basically, it could be used if you have a lot of data points and want to check a certain behaviour that should be guaranteed - but not always, only under certain preconditions.

Michael Borgwardt
+1 better answer than mine
dfa
+1  A: 

a theory is an elegant alternative to parameterized test, see my question here at stackoverflow

dfa