Code Contracts - Part 3 : Runtime Checker & Basic Contracts

added by Amoswolf
1/7/2011 2:34:35 AM

0 Kicks, 48 Views

In part 2 of this series we discussed the code contracts static checker. We began with some examples of animals getting ready to party. In this post we will use code contracts to define the rules of engagement of the animal party, and examine how the run time checker verifies these rules. Consider the following AnimalParty class. It is constructed with a list of animals (who presumably want to attend the party). It contains within it some unwritten assumptions about the party, in order to add additional animals to the party the internal collection of PartyAnimals must be initialized by the constructor to a not null value......


0 comments