public GherkinScenarioStepExtensions(IGherkinBlockStep step)
        {
            this.HasClassNotation = step.Description.Contains("{") && step.Description.Contains("}");
            if (this.HasClassNotation)
            {
                var raw = step.Description.Split('{')[1].Split('}')[0];
                if (raw.Length == 0)
                {
                    throw new ArgumentOutOfRangeException(
                              nameof(step),
                              "Feature writer has not specified a class name within the '{' '}' characters");
                }

                if (raw.Length == 1)
                {
                    this.ClassName = raw;
                    return;
                }

                var syntax = raw.ToSafeSyntax();
                this.ClassName = syntax.EndsWith("S", StringComparison.InvariantCultureIgnoreCase)
                    ? syntax.Substring(0, syntax.Length - 1)
                    : syntax;
            }
            else
            {
                this.ClassName = string.Empty;
            }
        }
Esempio n. 2
0
 public DataTableSyntaxStepClass(IGherkinBlockStep step, string className, ICollection <string> existingTypes)
     : base(step)
 {
     this.className    = className;
     this.GenerateType = !existingTypes.Contains(className);
     this.Initialize();
 }
 public DocStringSyntaxStep(IGherkinBlockStep step)
 {
     this.step         = step;
     this.id           = $"{step.Step.Localised}{step.Description.ToSafeSyntax()}";
     this.testCaseName = $"{this.id}TestCases()";
     this.CallSyntax   = $"{this.id}({this.testCaseName});";
     this.testCaseType = "System.Collections.Generic.IEnumerable<string>";
 }
Esempio n. 4
0
        public static IFixtureStep Create(IGherkinBlockStep scenario)
        {
            switch (scenario.Step.Syntax)
            {
            case GherkinStep.Given:
                return(new FixtureStep(typeof(GivenAttribute), scenario.Description));

            case GherkinStep.When:
                return(new FixtureStep(typeof(WhenAttribute), scenario.Description));

            case GherkinStep.Then:
                return(new FixtureStep(typeof(ThenAttribute), scenario.Description));

            case GherkinStep.And:
                return(new FixtureStep(typeof(AndAttribute), scenario.Description));

            case GherkinStep.But:
                return(new FixtureStep(typeof(ButAttribute), scenario.Description));
            }

            return(null);
        }
 /// <inheritdoc />
 protected override void When(IGherkinFeature sut)
 {
     this.background = this.Sut.Background;
     this.given      = this.Sut.Background.Steps.ElementAt(0);
     this.and        = this.Sut.Background.Steps.ElementAt(1);
 }
 public static IGherkinScenarioStepExtensions GherkinPlus(this IGherkinBlockStep step)
 {
     return(new GherkinScenarioStepExtensions(step));
 }
 public DataTableSyntaxStepTuple(IGherkinBlockStep step)
     : base(step)
 {
     this.Initialize();
 }
Esempio n. 8
0
 public DescriptionOnlySyntaxStep(IGherkinBlockStep step)
 {
     this.id         = $"{step.Step.Localised}{step.Description.ToSafeSyntax()}";
     this.callSyntax = $"{this.id}();";
 }
 protected DataTableSyntaxStep(IGherkinBlockStep step)
 {
     this.step       = step;
     this.id         = $"{step.Step.Localised}{step.Description.ToSafeSyntax()}";
     this.CallSyntax = string.Format("{0}({0}TestCases());", this.id);
 }