예제 #1
0
        /// <summary>
        /// Arrange all necessary preconditions and inputs.
        /// </summary>
        /// <param name="kernel">The <see cref="IFixtureKernel" /> Test Double IoC container.</param>
        /// <returns>
        /// The System/Software Under Test.
        /// </returns>
        protected override IFixtureMethods Given(IFixtureKernel kernel)
        {
            var gherkin = new StringBuilder();

            gherkin.AppendLine("Feature: Fixture Method Scenario Outline No Steps");
            gherkin.AppendLine("# ScenarioId: 001");
            gherkin.AppendLine("Scenario: Placeholder");
            gherkin.AppendLine("Given a placeholder");
            gherkin.AppendLine("# ScenarioId: 002");
            gherkin.AppendLine("Scenario Outline: Withdraw fixed amount");
            gherkin.AppendLine("Where: In credit");
            gherkin.AppendLine("test cases where the account is in credit");
            gherkin.AppendLine("| balance | withdrawal | received | remaining |");
            gherkin.AppendLine("| 500m    | 50m        | 50m      | 450m      |");
            gherkin.AppendLine("| 500m    | 100m       | 100m     | 400m      |");
            gherkin.AppendLine("| 500m    | 200m       | 200m     | 300m      |");

            var lexer = Lexer.For("c:\test.feature", new StringReader(gherkin.ToString()));
            var ast   = lexer.Parse();

            kernel.Bind(ast.Scenarios[1]);
            Get <IGherkinScenario>().Gherkin.ForAll(Console.WriteLine);

            kernel.Load(ctx => new FixtureMethodsBindings(WithTestRunner()));
            return(base.Given(kernel));
        }
        /// <summary>
        /// Arrange all necessary preconditions and inputs.
        /// </summary>
        /// <param name="kernel">The <see cref="IFixtureKernel" /> Test Double IoC container.</param>
        /// <returns>
        /// The System/Software Under Test.
        /// </returns>
        protected override IFixtureMethods Given(IFixtureKernel kernel)
        {
            var gherkin = new StringBuilder();

            gherkin.AppendLine("Feature: Fixture Method Scenario Outline No Steps");
            gherkin.AppendLine("# ScenarioId: 000");
            gherkin.AppendLine("Scenario: Placeholder");
            gherkin.AppendLine("Given a placeholder");
            gherkin.AppendLine("# ScenarioId: 001");
            gherkin.AppendLine("Scenario: Successful withdrawal from an account in credit");
            AddStep(gherkin);
            var lexer = Lexer.For("c:\test.feature", new StringReader(gherkin.ToString()));
            var ast   = lexer.Parse();

            kernel.Bind(ast.Scenarios[1]);
            Get <IGherkinScenario>().Gherkin.ForAll(Console.WriteLine);

            kernel.Load(ctx => new FixtureMethodsBindings(WithTestRunner()));
            return(base.Given(kernel));
        }