public static SyntaxScenario For(IGherkinScenario scenario) { if (scenario.Keyword.Syntax == GherkinKeyword.Scenario) { return(new SyntaxScenarioWithoutExamples()); } return(new SyntaxScenarioWithExamples(scenario)); }
public SyntaxScenarioWithExamples(IGherkinScenario scenario) { foreach (var value in scenario.Examples) { foreach (var el in value.TestCases.Values) { this.testCases.Add(new TestCaseSignature(el, MethodArgType.Argument)); } } var sig = new TestCaseSignature(scenario.Examples[0].TestCases.Parameters, MethodArgType.Parameter); this.Signature = this.testCases.Any() ? sig.Join(this.testCases[0]) : sig; }
public FixtureMethodBuilder(IGherkinBlock background, IGherkinScenario scenario, ISpockOptions options, IFixtureInvariants fixtureInvariants) { if (string.IsNullOrEmpty(scenario.Name)) { throw new GherkinException( GherkinExceptionType.InvalidGherkin, "No value representing the Scenario name found in the Gherkin feature file."); } this.background = background; this.scenario = scenario; this.options = options; this.fixtureInvariants = fixtureInvariants; }
public FixtureMethod( IGherkinBlock background, IMethods methods, IGherkinScenario scenario, ISpockOptions options, IFixtureInvariants fixtureInvariants) : base(options, fixtureInvariants) { this.background = background; this.scenario = scenario; this.Methods = methods; this.Identity = new MethodIdentity(scenario); var methodBuilder = SyntaxScenario.For(scenario); this.Signature = methodBuilder.Signature; this.TestCases = methodBuilder.TestCases; }
public void AddMethods(IGherkinScenario scenario) { var result = new FixtureMethodBuilder(this.gherkin.Background, scenario, this.options, this.fixtureInvariants); this.methods.AddRange(result.Build()); }