Inheritance Hierarchy
DeltaEngine.Tests.Extensions StackTraceExtensionsTests
Namespace: DeltaEngine.Tests.Extensions
Assembly: DeltaEngine.Tests (in DeltaEngine.Tests.dll) Version: 1.1.1.0 (1.1.1)
Syntax
The StackTraceExtensionsTests type exposes the following members.
Constructors
Name | Description | |
---|---|---|
StackTraceExtensionsTests | Initializes a new instance of the StackTraceExtensionsTests class |
Methods
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()); }
[Test] public void GetTestMethodName() { Assert.AreEqual("GetTestMethodName", new StackTrace().GetFrames().GetTestMethodName()); Assert.AreEqual("", new StackFrame[0].GetTestMethodName()); }
[Test] public void GetTestMethodNameFromMethodWithoutTestAttribute() { TestFromMethodWithoutTestAttribute(); }
[Test] public void GetClassName() { Assert.AreEqual("StackTraceExtensionsTests", new StackTrace().GetFrames().GetClassName()); Assert.AreEqual("", new StackFrame[0].GetClassName()); }
[Test] public void IsUnitTest() { Assert.IsTrue(StackTraceExtensions.IsUnitTest()); }
[Test, Ignore] public void FormatStackTraceIntoClickableMultilineText() { // This will output text into the NCrunch output window, which is needed to test this feature Console.WriteLine(StackTraceExtensions.FormatStackTraceIntoClickableMultilineText()); }
[Test, Ignore] public void FormatExceptionIntoClickableMultilineText() { try { TryFormatExceptionIntoClickableMultilineText(); } // ncrunch: no coverage catch (Exception ex) { Console.WriteLine(StackTraceExtensions.FormatExceptionIntoClickableMultilineText(ex)); } }
[Test] public void GetNamespaceFromUnitTestFullName() { StackTraceExtensions.SetUnitTestName(TestContext.CurrentContext.Test.FullName); Assert.AreEqual("DeltaEngine.Tests", StackTraceExtensions.GetExecutingAssemblyName()); }
[Test] public void GetTestMethodNameFromSetUpMethod() { FakeSetupMethod(); }
[Test, Category("Slow")] public void HasSlowCategoryAttribute() { var stackFrame = new StackFrame(); Assert.IsTrue(stackFrame.HasAttribute("NUnit.Framework.CategoryAttribute")); }
[TestCase(Ignore = true), Ignore] public void TestCaseHasIgnoreAttribute() { Assert.IsTrue(IsTestCaseWithIgnore(new StackFrame())); Assert.IsFalse(IsTestCaseWithSlowCategory(new StackFrame())); }
[TestCase(Category = "Slow")] public void TestCaseHasSlowCategoryAttribute() { Assert.IsFalse(IsTestCaseWithIgnore(new StackFrame())); Assert.IsTrue(IsTestCaseWithSlowCategory(new StackFrame())); }
[Test, Ignore] public void HasIgnoreAttribute() { var stackFrame = new StackFrame(); Assert.IsTrue(stackFrame.HasAttribute("NUnit.Framework.IgnoreAttribute")); }
See Also