StackTraceExtensions ClassDelta Engine Documentation
Provides additional check methods on stack traces to find out where we are (e.g. in tests) View code on GitHub
Inheritance Hierarchy

System Object
  DeltaEngine.Extensions StackTraceExtensions

Namespace: DeltaEngine.Extensions
Assembly: DeltaEngine (in DeltaEngine.dll) Version: 1.1.1.0 (1.1.1)
Syntax

public static class StackTraceExtensions

The StackTraceExtensions type exposes the following members.

Methods

  NameDescription
Public methodStatic memberForceUseOfMockResolver
Set by TeamCity to run Tests for CI builds with Mocks because it's faster View code on GitHub
Public methodStatic memberFormatExceptionIntoClickableMultilineText
Public methodStatic memberFormatStackTraceIntoClickableMultilineText
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
Public methodStatic memberGetApprovalTestName
Public methodStatic memberGetClassName
Public methodStatic memberGetEntryName
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
Public methodStatic memberGetExecutingAssemblyName
Public methodStatic memberGetTestMethodName
Public methodStatic memberHasAttribute
When we don't know the attribute type we cannot use Attribute.IsAttribute. Use this instead. View code on GitHub
Public methodStatic memberIsCloseAfterFirstFrameAttributeUsed
Public methodStatic memberIsStartedFromNCrunch
See http://www.ncrunch.net/documentation/troubleshooting_ncrunch-specific-overrides View code on GitHub
Public methodStatic memberIsUnitTest
Public methodStatic memberSetUnitTestName
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
Top
Properties

  NameDescription
Public propertyStatic memberStartedFromNCrunchOrNunitConsole
Public propertyStatic memberStartedFromNUnitConsoleButNotFromNCrunch
Public propertyStatic memberStartedFromProgramMain
Top
Remarks

Tests: DeltaEngine.Tests.Extensions.StackTraceExtensionsTests
Examples

15 unit tests call DeltaEngine.Extensions.StackTraceExtensions
[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