コード例 #1
0
        public void GivenThereAreScenarios(string featureTitle, int passCount, int failCount, int pendingCount, int ignoredCount)
        {
            StringBuilder featureBuilder = new StringBuilder();

            featureBuilder.AppendLine("Feature: " + featureTitle);

            foreach (var scenario in Enumerable.Range(0, passCount).Select(
                         i => string.Format("Scenario: passing scenario nr {0}\r\nWhen the step pass in " + featureTitle, i)))
            {
                featureBuilder.AppendLine(scenario);
                featureBuilder.AppendLine();
            }

            foreach (var scenario in Enumerable.Range(0, failCount).Select(
                         i => string.Format("Scenario: failing scenario nr {0}\r\nWhen the step fail in " + featureTitle, i)))
            {
                featureBuilder.AppendLine(scenario);
                featureBuilder.AppendLine();
            }

            foreach (var scenario in Enumerable.Range(0, pendingCount).Select(
                         i => string.Format("Scenario: pending scenario nr {0}\r\nWhen the step is pending", i)))
            {
                featureBuilder.AppendLine(scenario);
                featureBuilder.AppendLine();
            }

            foreach (var scenario in Enumerable.Range(0, ignoredCount).Select(
                         i => string.Format("@ignore\r\nScenario: ignored scenario nr {0}\r\nWhen the step is ignored", i)))
            {
                featureBuilder.AppendLine(scenario);
                featureBuilder.AppendLine();
            }

            inputProjectDriver.AddFeatureFile(featureBuilder.ToString());

            inputProjectDriver.AddStepBinding(ScenarioBlock.When, "the step pass in " + featureTitle, code: "//pass");
            inputProjectDriver.AddStepBinding(ScenarioBlock.When, "the step fail in " + featureTitle, code: "throw new System.Exception(\"simulated failure\");");
        }
コード例 #2
0
 public void GivenAllStepsAreBoundAndFail(ScenarioBlock scenarioBlock)
 {
     inputProjectDriver.AddStepBinding(scenarioBlock, ".*", code: "throw new System.Exception(\"simulated failure\");");
 }