shekharpro / mb-unit

Automatically exported from code.google.com/p/mb-unit
0 stars 0 forks source link

New contract verifier for method/constructor argument validation #442

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Suggested by Tim Rayment.

Implement a contract verifier that invokes an object method or 
constructor, and verifies that the expected exceptions are thrown when 
invalid arguments are passed (null, out of range, invalid, etc.) as 
specified in the declaration of the contract verifier.

Original issue reported on code.google.com by Yann.Tre...@gmail.com on 5 May 2009 at 8:29

GoogleCodeExporter commented 8 years ago

Original comment by jeff.br...@gmail.com on 29 Jun 2009 at 8:33

GoogleCodeExporter commented 8 years ago
Let's summarize the current situation. We have presently an undocumented 
contract 
verifier called "ArgumentValidationContract<TTarget>" which does that. But it 
seems 
finally that the value added is small, compared to the existing alternative 
(data-
driven test by using rows or a static factory)

Another solution, as discussed in a thread is to replace the current 
"horizontal" 
syntax (one row per invalid combination of arguments) by a "vertical" one (one 
row 
per valid/invalid argument) and let the engine compute all the possibilities. 
Unfortunately, the resulting syntax (initializer or fluent) is going to be 
complex 
and probably user unfriendly.

Should we drop that beast? Or do you thing about something else?

Original comment by Yann.Tre...@gmail.com on 6 Jul 2009 at 7:15

GoogleCodeExporter commented 8 years ago
Yeah, I don't really have a good general-purpose syntax for this.  We should 
probably
drop it for now.

Incidentally do you think we should allow contracts to be used as assertions 
within
other tests?

Assert.VerifyContract(new CollectionContract(....));

Original comment by jeff.br...@gmail.com on 6 Jul 2009 at 7:47

GoogleCodeExporter commented 8 years ago

Original comment by jeff.br...@gmail.com on 18 Jul 2009 at 5:20