public static void ContractFailed(object sender, ContractFailedEventArgs e)
{
if (e == null)
{
return;
}
e.SetUnwind(); // Causes the code to throw a ContractException after the event finishes
Assert.Fail(string.Format(CultureInfo.InvariantCulture, "{0}: {1}\r\nCondition: {2}", e.FailureKind, e.Message, e.Condition));
}