Class DebugView
Provides introspection and tracing capabilities for ease of debugging failing tests.
Inheritance
Inherited Members
Namespace: Telerik.JustMock
Assembly: Telerik.JustMock.dll
Syntax
public static class DebugView
Remarks
Often it’s not very clear why a test that uses the mocking API fails. A test may have multiple arrangements, each with various overlapping argument matchers. When you have a complex set of arrangements and the system under test makes a call to a mock, it’s sometimes hard to understand which arrangement actually gets executed and which expectations get updated. The DebugView class can help in such times. It can be used in two ways – to provide an overview of the current internal state of the mocking API, and to provide a step-by-step replay of the interception events happening inside the mocking API.
The current internal state is exposed through the CurrentState property. It contains a human-readable description of the current state of the mocking API. It describes in detail the state of all occurrence expectations and the number of calls to all intercepted methods. The first part is useful when debugging failing expectations from arrangements. The second part is useful for debugging failing occurrence asserts.
The step-by-step replay is intended for use with an interactive debugger (e.g. the Visual Studio managed debugger). To begin using it, add the DebugView class to a Watch in the debugger. Break the test execution before your test begins. Set the IsTraceEnabled property to true from the Watch window. Now, as you step over each line in your test, the FullTrace and LastTrace properties will be updated to show the events happening inside the mocking API. FullTrace will show the entire event log so far. LastTrace will contain all events that have happened since the debugger last updated the Watch window, but only if any new events have actually occurred.
Properties
CurrentState
Shows in human-readable format the current state of the mocking API internals.
Declaration
public static string CurrentState { get; }
Property Value
System.String
|
FullTrace
Shows the entire event log when the event trace is enabled.
Declaration
public static string FullTrace { get; }
Property Value
System.String
|
IsTraceEnabled
Enables or disables the step-by-step event trace.
Declaration
public static bool IsTraceEnabled { get; set; }
Property Value
System.Boolean
|
LastTrace
When the event trace is enabled, this property shows the portion of the event log that was added since the property was last evaluated.
Declaration
public static string LastTrace { get; }
Property Value
System.String
|