Example #1
0
        public RunnableStepBuilder WithScenarioText(string scenarioText)
        {
            var text = new ScenarioText(scenarioText);

            ScenarioText = text;

            return(this);
        }
Example #2
0
        private void SetScenarioText()
        {
            var stackFrames = new StackTrace().GetFrames();

            var stepAttributeFrame = stackFrames.FirstOrDefault(it => GetScenarioTextAttribute(it) != null);

            if (stepAttributeFrame != null)
            {
                SetParameters(stepAttributeFrame);
                ScenarioText = new ScenarioText($"{GetScenarioTextAttribute(stepAttributeFrame)}");
                return;
            }

            var callingFrame = stackFrames.FirstOrDefault(it => it.GetMethod().Name == _callerMember);

            if (callingFrame != null)
            {
                SetParameters(callingFrame);
                ScenarioText = new ScenarioText($"{callingFrame.GetMethod().Name.Humanize()}");
                return;
            }

            ScenarioText = new ScenarioText("No Scenario Text found (Use attribute [ScenarioText\"...\")] on your tests");
        }