protected IEnumerable <string> ElementLines(TestScenarioElement element, Dictionary <TestScenarioElement, string> elementFunctionNames) { yield return($"// {element.ToString()}"); yield return($"{elementFunctionNames[element]}();"); yield return(""); }
protected string FormatElement(TestScenarioElement element, string format) { try { return(SanitizeName(string.Format(format, element.Value))); } catch (FormatException e) { throw new FormatException($"Function name format '{format}' should not contain placeholders other than '{{0}}'", e); } }
protected string GetElementFunctionName(TestScenarioElement element) { switch (element) { case Given given: return(FormatElement(element, GivenFunctionName)); case When @when: return(FormatElement(element, WhenFunctionName)); case Then then: return(FormatElement(element, ThenFunctionName)); default: return(SanitizeName(element.Value)); } }