Ejemplo n.º 1
0
 /// <summary>
 /// Run the AfterTest action, but only if the BeforeTest
 /// action was actually run.
 /// </summary>
 /// <param name="test">The test to which the action applies</param>
 public void AfterTest(Interfaces.ITest test)
 {
     if (BeforeTestWasRun)
     {
         _action.AfterTest(test);
     }
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="TestActionCommand"/> class.
        /// </summary>
        /// <param name="innerCommand">The inner command.</param>
        /// <param name="action">The TestAction with which to wrap the inner command.</param>
        public TestActionCommand(TestCommand innerCommand, ITestAction action)
            : base(innerCommand)
        {
            Guard.ArgumentValid(innerCommand.Test is TestMethod, "TestActionCommand may only apply to a TestMethod", nameof(innerCommand));
            Guard.ArgumentNotNull(action, nameof(action));

            BeforeTest = (context) =>
            {
                action.BeforeTest(Test);
            };

            AfterTest = (context) =>
            {
                action.AfterTest(Test);
            };
        }