Howdy people, Me again with some more information of how both Code Contracts and Pex can be used together to write expressive tests (while still specifying a (partial) specification of the code). In the course of this article wel’ll also cover Assertions and Assumptions. In order to point out only the necessary topics, let’s introduce [...]
Posts Tagged ‘Code Contracts’
Code Contracts & Pex: Assertions and Assumptions for Expressive Tests
Posted in Automation, c#, Code Contracts, Pex, Unit testing, visual studio, tagged assert, Assertions, assume, assumptions, Code Contracts, expressive test, Pex, Unit testing, visual studio, Visual Studio 2010, white box testing on February 1, 2010 | 5 Comments »
Code Contracts: Static Checker ignores Objects Invariant for Same Type Parameter
Posted in Automation, c#, Code Contracts, Unit testing, visual studio, tagged assumption, Code Contracts, Design by Contract, ignore, ms_feeds, object invariant, postcondition, static checker, warning, windows7, workaround on January 25, 2010 | Leave a Comment »
Howdy all, Here comes another post about Code Contracts. Remember my post First Steps with Code Contracts? Let’s just recall which class we have been working on last time: 1: namespace Vehicles 2: { 3: class Car : IVehicle 4: { 5: string name; 6: int speed; 7: 8: public Car(string name, int speed) 9: [...]
Code Contracts: C# Code Snippets for Visual Studio
Posted in Automation, c#, Code Contracts, tips, visual studio, tagged cheat sheet, Code Contracts, ms_feeds, snippet, user manual, visual studio, windows7 on January 22, 2010 | 2 Comments »
Howdy, The Code Contracts User Manual holds (besides detailed information about Code Contracts’ usage, advantages and drawbacks) a few nice lists of Code Snippets that ship with the Code Contracts and will ease your life. Find below the list of available Code Snippets for the C# language, as exactly taken from the User Manual (January [...]
Code Contracts on Interfaces
Posted in Uncategorized, tagged Code Contracts, Design by Contract, interfaces, ms_feeds, precondition, visual studio, windows7 on January 22, 2010 | Leave a Comment »
Hello all, This time we’ll do a quick exploration of how we can apply Code Contracts to interfaces. As you know from our post First Steps with Code Contracts, the preconditions and postconditions (Contract.Requires and Contract.Ensures calls, respectively) must be placed inside a method body. Therefore, when defining an interface, we run into a problem: [...]
First Steps with Code Contracts
Posted in Automation, c#, Code Contracts, Unit testing, tagged Assertions, Code Contracts, Design by Contract, ms_feeds, postcondition, precondition, Tools, Visual Studio 2010, windows7 on January 21, 2010 | 4 Comments »
Hello all, Today we are going to talk about another exciting project from the Microsoft Research Labs: Code Contracts. It is a Design-By-Contract (DbC) system, that enables us as developers to formulate the expected behaviour of our code by directly putting it into the code. The main tools of applying Code Contracts are: Static checking [...]

