Provides additional check methods on stack traces to find out where we are (e.g. in tests)
View code on GitHub
Inheritance Hierarchy
DeltaEngine.Extensions StackTraceExtensions
Namespace: DeltaEngine.Extensions
Assembly: DeltaEngine (in DeltaEngine.dll) Version: 1.1.1.0 (1.1.1)
Syntax
The StackTraceExtensions type exposes the following members.
Methods
Name | Description | |
---|---|---|
![]() ![]() | ForceUseOfMockResolver |
Set by TeamCity to run Tests for CI builds with Mocks because it's faster
View code on GitHub |
![]() ![]() | FormatExceptionIntoClickableMultilineText | |
![]() ![]() | FormatStackTraceIntoClickableMultilineText |
Shows the callstack as multiline text output to help figure out who called what. Removes the
first callstack line (this method) and all non-helpful System, NUnit and nCrunch lines.
View code on GitHub |
![]() ![]() | GetApprovalTestName | |
![]() ![]() | GetClassName | |
![]() ![]() | GetEntryName |
Get entry name from stack frame, which is either the namespace name where the main method
is located or if we are started from a test, the name of the test method.
View code on GitHub |
![]() ![]() | GetExecutingAssemblyName | |
![]() ![]() | GetTestMethodName | |
![]() ![]() | HasAttribute |
When we don't know the attribute type we cannot use Attribute.IsAttribute. Use this instead.
View code on GitHub |
![]() ![]() | IsCloseAfterFirstFrameAttributeUsed | |
![]() ![]() | IsStartedFromNCrunch |
See http://www.ncrunch.net/documentation/troubleshooting_ncrunch-specific-overrides
View code on GitHub |
![]() ![]() | IsUnitTest | |
![]() ![]() | SetUnitTestName |
Since we do not initialize or run the resolver in a test, we need to set the current unit
test name up beforehand so we can find out if the test uses ApproveFirstFrameScreenshot.
View code on GitHub |
Properties
Name | Description | |
---|---|---|
![]() ![]() | StartedFromNCrunchOrNunitConsole | |
![]() ![]() | StartedFromNUnitConsoleButNotFromNCrunch | |
![]() ![]() | StartedFromProgramMain |
Remarks
Examples
[Test] public void HasAttribute() { var stackFrame = new StackFrame(); Assert.IsTrue(stackFrame.HasAttribute("NUnit.Framework.TestAttribute")); Assert.IsFalse(stackFrame.HasAttribute("Foo.Baar")); }
[Test] public void IsApprovalTest() { Assert.AreEqual("", StackTraceExtensions.GetApprovalTestName()); }
[Test] public void GetEntryName() { Assert.AreEqual("GetEntryName", StackTraceExtensions.GetEntryName()); }
See Also