Пример #1
0
        private static Background ConvertToCompatibleBackground(global::Gherkin.Ast.Background background)
        {
            if (background == null)
            {
                return(null);
            }

            return(new Background(background.Keyword, background.Name, background.Description, ConvertToCompatibleSteps(background.Steps))
            {
                FilePosition = ConvertToCompatibleFilePosition(background.Location)
            });
        }
Пример #2
0
        public Scenario ExtractScenario(global::Gherkin.Ast.Scenario scenario, global::Gherkin.Ast.Background background)
        {
            if (scenario == null)
            {
                throw new ArgumentNullException(nameof(scenario));
            }

            var steps = ExtractSteps(scenario);

            if (background != null)
            {
                steps = ExtractSteps(background).Concat(steps).ToList();
            }

            return(new Scenario(scenario.Name, steps));
        }
Пример #3
0
        public static global::Gherkin.Ast.Scenario ApplyBackground(
            this global::Gherkin.Ast.Scenario @this,
            global::Gherkin.Ast.Background background)
        {
            if (background == null)
            {
                throw new ArgumentNullException(nameof(background));
            }

            var stepsWithBackground = background.Steps.Concat(@this.Steps).ToArray();

            return(new global::Gherkin.Ast.Scenario(
                       @this.Tags.ToArray(),
                       @this.Location,
                       @this.Keyword,
                       @this.Name,
                       @this.Description,
                       stepsWithBackground));
        }