Esempio n. 1
0
        protected IEnumerable <string> ElementLines(TestScenarioElement element, Dictionary <TestScenarioElement, string> elementFunctionNames)
        {
            yield return($"// {element.ToString()}");

            yield return($"{elementFunctionNames[element]}();");

            yield return("");
        }
Esempio n. 2
0
 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);
     }
 }
Esempio n. 3
0
        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));
            }
        }