Supports: GherkinSpec v2.0, assumes C# 6 compiler for interpolated strings in Scenario Outlines. If you don't need those, use simple '+' or String.Format(...), that switch might be added to generator at later time
{{#foreach: usings}}using {{$data}};
{{/foreach}}
namespace {{namespaceName}}
{
[Feature({{$root.loaderText}}){{#if $root.mode()=="MsTest"}} TestClass{{/if}}]
public class {{name.split(' ').join('_')}} : {{$root.baseClass}}
{
{{#if background}}protected override void Background()
{
{{#foreach: background.steps}}{{#if $root.useKeywords() && $root.knownKeywordsArray().indexOf(keyword.trim()) > -1}}{{keyword.trim()}}("{{/if}}{{#ifnot $root.useKeywords() && $root.knownKeywordsArray().indexOf(keyword.trim()) > -1}}Step("{{keyword}}{{/ifnot}}{{text.split('"').join('\\\"')}}");
{{/foreach}}
}
{{/if}}
{{#foreach: scenarioDefinitions}}[Scenario{{#if: $root.useSeparateScenarioNames}}("{{name}}"){{/if}}{{#if $root.mode()=="MsTest"}} TestMethod{{/if}}]
public void {{name.split(' ').join('_')}}()
{
{{#if type=='ScenarioOutline'}}foreach (var exampleSet in ExampleSets)
foreach (var example in exampleSet)
{
{{#foreach: steps}}{{#if $root.useKeywords() && $root.knownKeywordsArray().indexOf(keyword.trim()) > -1}}{{keyword.trim()}}($"{{/if}}{{#ifnot $root.useKeywords() && $root.knownKeywordsArray().indexOf(keyword.trim()) > -1}}Step($"{{keyword}}{{/ifnot}}{{text.split('"').join('\\\"').split('<').join('{example["').split('>').join('"]}')}}");
{{/foreach}}
}{{/if}}{{#ifnot type=='ScenarioOutline'}}{{#foreach: steps}}{{#if $root.useKeywords() && $root.knownKeywordsArray().indexOf(keyword.trim()) > -1}}{{keyword.trim()}}("{{/if}}{{#ifnot $root.useKeywords() && $root.knownKeywordsArray().indexOf(keyword.trim()) > -1}}Step("{{keyword}}{{/ifnot}}{{text.split('"').join('\\\"')}}");
{{#if argument}}{
{{#if argument.type == 'DocString' }}var argument = ArgumentString{{/if}}{{#if argument.type != 'DocString' && argument.rows[0].cells.length == 1}}var arguments = ArgumentList{{/if}}{{#if argument.type != 'DocString' && argument.rows[0].cells.length != 1}}var arguments = ArgumentTable{{/if}};
}{{/if}}
{{/foreach}}{{/ifnot}}
}
{{/foreach}}{{#if $root.allScenariosCoveredTest}}{{#if $root.mode()=="MsTest"}}[TestMethod]{{/if}}{{#if $root.mode()=="XUnit"}}[Fact]{{/if}}
public void All_scenarios_covered()
{
{{#if $root.mode()=="MsTest"}}Assert.IsTrue(AllScenariosCovered);{{/if}}{{#if $root.mode()=="XUnit"}}Assert.True(AllScenariosCovered);{{/if}}
}{{/if}}
}
}