-
Book Overview & Buying
-
Table Of Contents
C# Programming Cookbook
By :
IntelliTest allows developers to create and run tests against their code contracts. This allows developers to create the most robust code possible by creating additional code contracts to pass the test failures reported by IntelliTest. One thing to note, however, is that IntelliTest is included in the Visual Studio Enterprise only.
You will need to use Visual Studio Enterprise 2015 to be able to create and run IntelliTests.
Before you go on, ensure that you have added the code contracts using statement to the top of your Recipes.cs class file:
using System.Diagnostics.Contracts;
Add a new class called CodeContractTests to your Recipes.cs file:
public class CodeContractTests
{
}Then, add a method called Calculate() to the CodeContractTests class and pass two integer values as parameters to the Calculate() method. Inside the Calculate() method, add a code contract to ensure that the result from this method is never equal to zero:
public...