Skip to main content

Posts

Showing posts with the label wcf

Code Contracts - .NET Features

How do you make sure your method guarantees to operate correctly under defined expected input states? Well Code Contracts may help you. One of the fine features provided by .net 4.0 is Code Contracts. First it’s worth thinking a little about what contract means to you. They indicate the expected input states under which the method guarantees to operate correctly. Contracts act as checked documentation of your external and internal APIs to be shipped. The code contracts are used to improve testing via runtime-checking, enable static contract verification. One of the interesting features of Code Contracts is that it includes a MSIL rewriter (ccrewrite.exe) that post-processes an assembly to change the intermediate language instructions emitted by the compiler. Another great feature of Code Contracts is that you can turn static analysis on and off on a per project basis. I believe this will be important to anyone practicing TDD and BDD. A code contract follows design principle of Design B...