//public static ScenarioStepContext GetStepContext(this SpecFlowContext context) //{ // var result = context.GetOrDefault<ScenarioStepContext>("__stepContext__", null); // if (result != null) return result; // // If this method was called with a step context then use it otherwise set to null. // SetStepContext(context, context as ScenarioStepContext); // return context.Get<ScenarioStepContext>("__stepContext__"); //} //public static void SetStepContext(this SpecFlowContext context, ScenarioStepContext value) // => context.Set(value, "__stepContext__"); //public static ScenarioContext GetScenarioContext(this SpecFlowContext context) //{ // var result = context.GetOrDefault<ScenarioContext>("__scenarioContext__", null); // if (result != null) return result; // // If this method was called with a scenario context then use it otherwise set to null. // SetScenarioContext(context, context as ScenarioContext); // return context.Get<ScenarioContext>("__scenarioContext__"); //} //public static void SetScenarioContext(this SpecFlowContext context, ScenarioContext value) // => context.Set(value, "__scenarioContext__"); public static FeatureContext GetFeatureContext(this SpecFlowContext context) { var result = context.GetOrDefault <FeatureContext>("__featureContext__", null); if (result != null) { return(result); } // If this method was called with a feature context then use it otherwise set to null. SetFeatureContext(context, context as FeatureContext); return(context.Get <FeatureContext>("__featureContext__")); }