Given the following example code, how can I configure Pex to respect my Code Contracts?
public static IEnumerable Administrators(this UserGro
First you need to use a typed version of Requires
use ArgumentNullException as T
Also in you project properties you need to tell code cotracts to use the standard rewriter. DO NOT click assert on failure ;)
Contract.Requires(i != null);
then your code will throw an argumetn null exception and pex can add an attribute to your pexmethod to say that it is allowed to throw it and will create a passing test that throws the exception
you can then promote those and save the unit tests