• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

Has anyone experimented with Code Contracts for .NET

Bulldog13

Golden Member
Title pretty much explains it all. Does anyone have an opinion on Code Contracts (http://msdn.microsoft.com/en-us/devlabs/dd491992) ?

I am doing some greenfield development unit tests and find myself doing alot of null checking and was wondering if this would be an easier way to go about it?

Before I dedicated the time to learning it though, I was wondering if anyone had positive reviews on them.

Thanks
 
I've only read the stuff about them.. they seem pretty interesting. Hoping you get some responses to this 🙂
 
Contracts are a brilliant way for some types of problems. Algorithmic tests that are numerical or produce particular simple results from input->output (pure functional) are simple enough to produce invariants for in general its more natural to do it this way.

Less algorithmic parts such as code with side effects or where your checking message passing from object to object become more problematic with invariant tests and you end up relying on normal case base unit tests.

A mix of the two approaches is best depending on what your testing.
 
Contracts are a brilliant way for some types of problems. Algorithmic tests that are numerical or produce particular simple results from input->output (pure functional) are simple enough to produce invariants for in general its more natural to do it this way.

Less algorithmic parts such as code with side effects or where your checking message passing from object to object become more problematic with invariant tests and you end up relying on normal case base unit tests.

A mix of the two approaches is best depending on what your testing.
 
Back
Top