Esempio n. 1
0
        public FixtureBuilder(IGherkinFeature gherkin, ISpockOptions options)
        {
            this.gherkin           = gherkin;
            this.options           = options;
            this.fixtureInvariants = new FixtureInvariants(gherkin, options);

            var summary = new List <string>
            {
                "Feature Id: " + this.fixtureInvariants.FeatureId,
                gherkin.Name,
                gherkin.Description
            };

            if (gherkin.Background != null)
            {
                summary.AddRange(gherkin.Background.Gherkin);
            }

            var disabled = gherkin.Comments.DisabledScenarios("<item>", "</item>").ToArray();

            if (disabled.Any())
            {
                const string header =
                    "The following Scenario Ids (Test Step Id's) have been disabled from this fixture. Please review " +
                    "the original test cases XML file to see if the test scenario was valid, and if " +
                    "so, update the Gherkin .feature file to reflect the test case. Then regenerate " +
                    "this test fixture to include the new scenario.";

                var builder = new StringBuilder();
                builder.Append(header);
                builder.Append("<list type=\"bullet\">");
                foreach (var d in disabled)
                {
                    builder.Append(d);
                }

                builder.Append("</list>");
                summary.Add(builder.ToString());
            }

            this.comments.AddRange(CodeGeneration.ToXmlSummary(summary.ToArray(), false));
            this.comments.AddRange(CodeGeneration.ToXmlRemarks(gherkin.Gherkin, new[] { "example", "code language=\"none\" title=\"Gherkin\"" }));
            this.feature = FixtureStep.Create(GherkinKeyword.Feature, gherkin.Description);
            if (gherkin.Background == null)
            {
                return;
            }

            this.background = new BackgroundBuilder(gherkin.Background).Build();
            this.feature.AddBackground(this.background);
        }
Esempio n. 2
0
        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;
        }
Esempio n. 3
0
 public SpockFixture(
     IGherkinFeature gherkin,
     IFixtureInvariants fixtureInvariants,
     IFixtureStep feature,
     IEnumerable <string> comments,
     IFixtureBackground background,
     IFixtureMethods methods,
     ISpockOptions options)
     : base(options, fixtureInvariants)
 {
     this.gherkin           = gherkin;
     this.FixtureInvariants = fixtureInvariants;
     this.GherkinAttributes = feature;
     this.XmlDocComments    = new SpockCollection <string>(comments);
     this.Background        = background;
     this.FixtureMethods    = methods;
 }
Esempio n. 4
0
        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;
        }
 protected SpecificationBase(ISpockOptions options, IFixtureInvariants fixtureInvariants)
 {
     this.Options           = options;
     this.fixtureInvariants = fixtureInvariants;
 }