StoryTeller.Grammars.SilentAction.Execute C# (CSharp) Method

Execute() public method

public Execute ( SpecContext context ) : void
context SpecContext
return void
        public void Execute(SpecContext context)
        {
            using (context.Timings.Subject(type, Subject))

            try
            {
                Action(context);
                context.LogResult(new StepResult(Id, ResultStatus.ok) {position = Position});
            }
            catch (Exception ex)
            {
                context.LogException(Node.id,
                    ex,
                    Position);
            }
        }
    }

Usage Example

        public void execute_happy_path()
        {
            var wasCalled = false;
            var section = new Section("Math"){id = "4"};
            var action = new SilentAction("Fixture", Stage.setup, x => wasCalled = true, section);
            var context = SpecContext.ForTesting();
            action.Execute(context);

            ShouldBeTestExtensions.ShouldBe(wasCalled, true);

        }
All Usage Examples Of StoryTeller.Grammars.SilentAction::Execute