11using System ;
22using System . Linq ;
3+ using System . Runtime . CompilerServices ;
34using TestStack . BDDfy . Configuration ;
45
56namespace TestStack . BDDfy
67{
78 public static class BDDfyExtensions
89 {
10+ #if StackTrace
911 /// <summary>
1012 /// Extension method to BDDfy an object instance.
1113 /// </summary>
@@ -28,18 +30,57 @@ public static Engine LazyBDDfy(this object testObject, string scenarioTitle = nu
2830 /// <typeparam name="TStory">The type representing the story.</typeparam>
2931 /// <param name="testObject">The test object representing a scenario.</param>
3032 /// <param name="scenarioTitle">Overrides the default scenario title and is displayed in the reports.</param>
33+ /// <param name="caller">Caller (populated by [CallerMemberName])</param>
3134 /// <returns></returns>
3235 public static Story BDDfy < TStory > ( this object testObject , string scenarioTitle = null )
3336 where TStory : class
3437 {
35- return testObject . LazyBDDfy < TStory > ( scenarioTitle ) . Run ( ) ;
38+ return InternalLazyBDDfy ( testObject , scenarioTitle , typeof ( TStory ) ) . Run ( ) ;
3639 }
3740
3841 public static Engine LazyBDDfy < TStory > ( this object testObject , string scenarioTitle = null )
3942 where TStory : class
4043 {
4144 return InternalLazyBDDfy ( testObject , scenarioTitle , typeof ( TStory ) ) ;
4245 }
46+ #else
47+ /// <summary>
48+ /// Extension method to BDDfy an object instance.
49+ /// </summary>
50+ /// <param name="testObject">The test object representing a scenario.</param>
51+ /// <param name="scenarioTitle">Overrides the default scenario title and is displayed in the reports.</param>
52+ /// <param name="caller">Caller (populated by [CallerMemberName])</param>
53+ /// <returns></returns>
54+ public static Story BDDfy ( this object testObject , string scenarioTitle = null , [ CallerMemberName ] string caller = null )
55+ {
56+ return InternalLazyBDDfy ( testObject , scenarioTitle ?? Configurator . Scanners . Humanize ( caller ) ) . Run ( ) ;
57+ }
58+
59+ public static Engine LazyBDDfy ( this object testObject , string scenarioTitle = null , [ CallerMemberName ] string caller = null )
60+ {
61+ return InternalLazyBDDfy ( testObject , scenarioTitle ?? Configurator . Scanners . Humanize ( caller ) ) ;
62+ }
63+
64+ /// <summary>
65+ /// Extension method to BDDfy an object instance.
66+ /// </summary>
67+ /// <typeparam name="TStory">The type representing the story.</typeparam>
68+ /// <param name="testObject">The test object representing a scenario.</param>
69+ /// <param name="scenarioTitle">Overrides the default scenario title and is displayed in the reports.</param>
70+ /// <param name="caller">Caller (populated by [CallerMemberName])</param>
71+ /// <returns></returns>
72+ public static Story BDDfy < TStory > ( this object testObject , string scenarioTitle = null , [ CallerMemberName ] string caller = null )
73+ where TStory : class
74+ {
75+ return InternalLazyBDDfy ( testObject , scenarioTitle ?? Configurator . Scanners . Humanize ( caller ) , typeof ( TStory ) ) . Run ( ) ;
76+ }
77+
78+ public static Engine LazyBDDfy < TStory > ( this object testObject , string scenarioTitle = null , [ CallerMemberName ] string caller = null )
79+ where TStory : class
80+ {
81+ return InternalLazyBDDfy ( testObject , scenarioTitle ?? Configurator . Scanners . Humanize ( caller ) , typeof ( TStory ) ) ;
82+ }
83+ #endif
4384
4485 static Engine InternalLazyBDDfy (
4586 object testObject ,
0 commit comments