Inheritance: ILogger, ILogWithEmphasis, ILogWithImages, ILogWithExpandableSections
Beispiel #1
0
 /// <summary>
 /// New behaviour factory method
 /// </summary>
 /// <param name="businessValue">text describing the business value</param>
 /// <param name="targetApplicationLayer">project folder name containing target test class implementations</param>
 /// <param name="loggers">instance of loggers</param>
 /// <returns>new behaviour instance</returns>
 public static Behaviour SoThat(string businessValue, string targetApplicationLayer, Loggers loggers)
 {
     string testName = GetTestName();
     loggers.SetStartTextsToEmphasise("I want", "So that", "As", "Given", "When", "Then", "And");
     loggers.SetStartTextsToHaveSectionOpen("As");
     return new Behaviour(targetApplicationLayer, loggers, testName, businessValue);
 }
Beispiel #2
0
 private Behaviour(string targetApplicationLayer, Loggers loggers, string testName, string businessValue)
 {
     _loggers = loggers;
     _targetApplicationLayer = targetApplicationLayer;
     Log(() => _loggers.WriteLine("{0}", new[] {testName}));
     Log(() => _loggers.WriteLine("so that" + Loggers.MidAlignSeparator + businessValue.ExpandToReadable().DecapitaliseInitial()));
     _loggers.StepsStart();
 }
Beispiel #3
0
 /// <summary>
 /// New behaviour factory method
 /// </summary>
 /// <param name="businessValue">text describing the business value</param>
 /// <param name="targetApplicationLayer">project folder name containing target test class implementations</param>        
 /// <param name="appRunner">your page object model instance or other to operate the application</param>
 /// <param name="loggers">instance of loggers</param>
 /// <param name="preStepAction"> </param>
 /// <returns>new behaviour instance</returns>
 public static Behaviour SoThat(string businessValue, string targetApplicationLayer, object appRunner, Loggers loggers, Action preStepAction = null)
 {
     string testName = GetTestName();
     loggers.SetStartTextsToEmphasise("I want", "So that", "As", "Given", "When", "Then", "And");
     loggers.SetStartTextsToHaveSectionOpen("As");
     var behaviour = new Behaviour(targetApplicationLayer, appRunner, loggers, testName, businessValue, preStepAction);
     return behaviour;
 }
Beispiel #4
0
 private Behaviour(string targetApplicationLayer, object appRunner, Loggers loggers, string testName, string businessValue, Action preStepAction = null)
 {
     _appRunner = appRunner;
     _loggers = loggers;
     _preStepAction = preStepAction;
     _targetApplicationLayer = targetApplicationLayer;
     Log(() => _loggers.WriteLine("{0}", new[] { testName }));
     Log(() => _loggers.WriteLine("so that" + Loggers.MidAlignSeparator + businessValue.ExpandToReadable().DecapitaliseInitial()));
 }
Beispiel #5
0
 private void SetLoggerOnPersonaImplementation(object persona, Loggers loggers)
 {
     try
     {
         PropertyInfo entityProperty =
             persona.GetType().GetProperties().FirstOrDefault(x => x.PropertyType == typeof(ILogger));
         entityProperty.SetValue(persona, loggers);
     }
     catch
     {
         //ignore
     }
 }