Contract Events
The Contract
class exposes a ContractFailed
event that is raised when a condition is violated and that you can handle to get detailed information. The following sample event handler shows how to collect violation information:
The ContractFailedEventArgs.Condition
property is a string storing the condition while the ContractFailedEventArgs.FailureKind
is an enumeration offering the failure kind (for example, Precondition
, Invariant
, and so on).
Summary
This chapter illustrated the Visual Studio instrumentation and libraries about testing applications. The first discussion was about unit testing, a technique used for checking if ...
Get Visual Basic® 2010 Unleashed now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.