Revision: 70
Author: goeran.hansen
Date: Tue Nov 3 15:09:15 2009
Log: Wrote a learning test to find out how to get the callers method name.
Easy using StackeTrace
http://code.google.com/p/tinybdd/source/detail?r=70
Added:
/trunk/TinyBDDTests/Learning/StackTraceTests.cs
Modified:
/trunk/TinyBDDTests/TinyBDDTests.csproj
=======================================
--- /dev/null
+++ /trunk/TinyBDDTests/Learning/StackTraceTests.cs Tue Nov 3 15:09:15 2009
@@ -0,0 +1,25 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using NUnit.Framework;
+using System.Diagnostics;
+
+using TinyBDD.Specification.NUnit;
+
+namespace TinyBDDTests.Learning
+{
+ [TestFixture]
+ public class StackTraceTests
+ {
+ [Test]
+ public void Get_callers_method_name()
+ {
+ StackTrace a = new StackTrace();
+ var frames = a.GetFrames();
+ var parentMethod = frames.First().GetMethod();
+ Console.WriteLine(parentMethod.Name);
+ parentMethod.Name.ShouldBe("Get_callers_method_name");
+ }
+ }
+}
=======================================
--- /trunk/TinyBDDTests/TinyBDDTests.csproj Tue Nov 3 14:08:16 2009
+++ /trunk/TinyBDDTests/TinyBDDTests.csproj Tue Nov 3 15:09:15 2009
@@ -83,6 +83,7 @@
<Compile Include="Dsl\GivenWhenThen\ThenSemanticsTests.cs" />
<Compile Include="Learning\CreateCodeAtRuntimeTests.cs" />
<Compile Include="Learning\FileSystemWatcherTests.cs" />
+ <Compile Include="Learning\StackTraceTests.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="SemanticModel\AAATests.cs" />
</ItemGroup>