Source code for the CodeContracts tools for .NET
Перейти к файлу
Hubert Bukowski d6e47e68ab Added template parameters mapping to contracts and closures dupicator. 2016-02-12 23:39:03 +01:00
.nuget
Common
Demo
Documentation
ExperimentalTools
Foxtrot Added template parameters mapping to contracts and closures dupicator. 2016-02-12 23:39:03 +01:00
Microsoft.Research Do not run 'git update-index' outside git reprository. 2016-02-09 10:29:02 +01:00
Microsoft.VisualStudio.CodeTools
System.Compiler Merge pull request #341 from SergeyTeplyakov/bugs/bug340 2016-02-06 21:31:36 -08:00
.gitattributes
.gitignore
CCR.sln
CONTRIBUTING.md
CodeContracts.sln
CodeContracts10.vsmdi
FoxtrotTestRun.testrunconfig
LICENSE.txt
Local.testsettings
README.md
TraceAndTestImpact.testsettings
appveyor.yml Enable foxtrot tests 2016-02-05 10:35:36 -08:00
build.bat
buildCC.bat
oob.sln

README.md

CodeContracts

Join the chat at https://gitter.im/Microsoft/CodeContracts

Source code for the CodeContracts tools for .NET

Code Contracts provide a language-agnostic way to express coding assumptions in .NET programs.

The contracts take the form of pre-conditions, post-conditions, and object invariants. Contracts act as checked documentation of your external and internal APIs. The contracts are used to improve testing via runtime checking, enable static contract verification, and documentation generation. Code Contracts bring the advantages of design-by-contract programming to all .NET programming languages. We currently provide three tools: Runtime Checking. Our binary rewriter modifies a program by injecting the contracts, which are checked as part of program execution. Rewritten programs improve testability: each contract acts as an oracle, giving a test run a pass/fail indication.

Automatic testing tools, such as Pex, take advantage of contracts to generate more meaningful unit tests by filtering out meaningless test arguments that don't satisfy the pre-conditions.

Static Checking. Our static checker can decide if there are any contract violations without even running the program! It checks for implicit contracts, such as null dereferences and array bounds, as well as the explicit contracts.

Documentation Generation. Our documentation generator augments existing XML doc files with contract information. There are also new style sheets that can be used with Sandcastle so that the generated documentation pages have contract sections.

Building from source

For working on the project, open CodeContracts.sln and build.

To create the installer and the nuget package, just run buildCC <version>.

We use the convention:

  • CC major version = 1.9.1
  • CC minor version = {month}{day}.{buildInTheDay}

For instance, the 10th build on July 16 would be run as follows:

buildCC 1.9.10716.10