Tuesday, January 25, 2011

.NET 4.0 (Code Contracts) - 1

Code Contracts

Code Contracts provide a way to specify preconditions, postconditions and object invariants.

Benefits
Improved Testing
Automatic Testing Tools
Static Verification
Reference Documentation



Preconditions


Click the Project Properties Context Menu



If you don't see Code Contracts, download and install code contracts from the following link
http://msdn.microsoft.com/en-us/devlabs/dd491992.aspx

Run the solution




PostCondition Code Contract


Object Invariant