Description
Code Contracts for is a rather feature-rich contract library for .NET.
Setup
Code Contracts partially work out of the box in Visual Studio. Your code will compile (because contract support resides in System.Diagnostics.Contracts)
, but you’ll get an ugly error dialog prompting you to install the tools if you run the code. To enable full support, install the package from the Code Contracts for .NET homepage.
Download the tools and install them (administrator privileges are required). Then, restart Visual Studio and enable the contract support on the project properties page. Like this, for example.
Verify your setup by running the tests in the chapter 5 samples.