コード例 #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 IGherkinFeature Given(IFixtureKernel kernel)
        {
            var f = new StringBuilder();

            f.AppendLine("Feature: Calculator");
            f.AppendLine("Scenario: Add two numbers");
            f.AppendLine("Given a <first>:");
            f.AppendLine("| first |");
            f.AppendLine("| 1 |");
            f.AppendLine("| 2 |");
            f.AppendLine("When add a 10");
            f.AppendLine("Then should have <result>:");
            f.AppendLine("| result |");
            f.AppendLine("| 11 |");
            f.AppendLine("| 12 |");
            f.AppendLine("Scenario: Subtract two numbers");
            f.AppendLine("  Given a <first>:");
            f.AppendLine("    | first |");
            f.AppendLine("    | 11 |");
            f.AppendLine("    | 12 |");
            f.AppendLine("  When subtract a 10");
            f.AppendLine("  Then should have <result>:");
            f.AppendLine("    | result |");
            f.AppendLine("    | 1 |");
            f.AppendLine("    | 0 |");

            return(LexerFeature.Create(f.ToString()));
        }
コード例 #2
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 IGherkinFeature Given(IFixtureKernel kernel)
        {
            var f = new StringBuilder();

            f.AppendLine("Feature: Calculator");
            f.AppendLine("Scenario Outline: Add two numbers");
            f.AppendLine("    System should add two");
            f.AppendLine("    numbers");
            f.AppendLine("Given a <first>");
            f.AppendLine("When add a <second>");
            f.AppendLine("Then should have <result>");
            f.AppendLine("Examples:");
            f.AppendLine("| first | second | result |");
            f.AppendLine("| 1 | 2 | 3 |");
            f.AppendLine("| 1 | 3 | 4 |");
            f.AppendLine("Scenario Outline: Subtract two numbers");
            f.AppendLine("  Given a <first>:");
            f.AppendLine("  When subtract a <second>");
            f.AppendLine("  Then should have <result>:");
            f.AppendLine("Examples:");
            f.AppendLine("    | first | second | result |");
            f.AppendLine("    |    11 |     10 |      1 |");
            f.AppendLine("    |    12 |     10 |      2 |");

            return(LexerFeature.Create(f.ToString()));
        }
コード例 #3
0
        /// <inheritdoc />
        protected override IGherkinFeature Given(IFixtureKernel kernel)
        {
            var f = new StringBuilder();

            f.AppendLine("Feature: Calculator");
            f.AppendLine("In order to avoid silly mistakes");
            f.AppendLine("as a math idiot");
            f.AppendLine("I want to be told the sum of two numbers");

            return(LexerFeature.Create(f.ToString()));
        }
コード例 #4
0
        /// <inheritdoc />
        protected override IGherkinFeature Given(IFixtureKernel kernel)
        {
            var f = new StringBuilder();

            f.AppendLine("# language: fr");
            f.AppendLine("Fonctionnalité: Calculator");
            f.AppendLine("  Contexte: Set up initial state");
            f.AppendLine("  Get the system in a state to do this");
            f.AppendLine("    Soit the system is this");
            f.AppendLine("    Et it is doing this");

            return(LexerFeature.Create(f.ToString()));
        }
コード例 #5
0
        /// <inheritdoc />
        protected override IGherkinFeature Given(IFixtureKernel kernel)
        {
            var f = new StringBuilder();

            f.AppendLine("# language: en");
            f.AppendLine("Feature: Calculator");
            f.AppendLine("  Background: Set up initial state");
            f.AppendLine("    Get the system in a state to do this");
            f.AppendLine("    Given the system is this");
            f.AppendLine("    And it is doing this");

            return(LexerFeature.Create(f.ToString()));
        }
コード例 #6
0
        /// <inheritdoc />
        protected override IGherkinFeature Given(IFixtureKernel kernel)
        {
            var f = new StringBuilder();

            f.AppendLine("# language: fr");
            f.AppendLine("Fonctionnalité: Calculator");
            f.AppendLine("Scénario: Add two numbers");
            f.AppendLine("Soit a <first>:");
            f.AppendLine("| first |");
            f.AppendLine("| 1 |");
            f.AppendLine("| 2 |");
            f.AppendLine("Quand add a 10");
            f.AppendLine("Alors should have <result>:");
            f.AppendLine("| result |");
            f.AppendLine("| 11 |");
            f.AppendLine("| 12 |");

            return(LexerFeature.Create(f.ToString()));
        }
コード例 #7
0
        /// <inheritdoc />
        protected override IGherkinFeature Given(IFixtureKernel kernel)
        {
            var f = new StringBuilder();

            f.AppendLine("Feature: Calculator");
            f.AppendLine("Scenario: Add two numbers");
            f.AppendLine("Given a <first>:");
            f.AppendLine("| first |");
            f.AppendLine("| 1 |");
            f.AppendLine("| 2 |");
            f.AppendLine("When add a 10");
            f.AppendLine("    \"\"\"");
            f.AppendLine("    some text");
            f.AppendLine("      here with spacing");
            f.AppendLine("    \"\"\"");
            f.AppendLine("  And something else goes on");
            f.AppendLine("Then should have result");

            return(LexerFeature.Create(f.ToString()));
        }
コード例 #8
0
        /// <inheritdoc />
        protected override IGherkinFeature Given(IFixtureKernel kernel)
        {
            var f = new StringBuilder();

            f.AppendLine("@ category: Integration");
            f.AppendLine("Feature: Calculator");
            f.AppendLine("Scenario: Add two numbers");
            f.AppendLine("Given a <first>:");
            f.AppendLine("| first |");
            f.AppendLine("| 1 |");
            f.AppendLine("| 2 |");
            f.AppendLine("And the system is in this state");
            f.AppendLine("# And this is commented out");
            f.AppendLine("And the system is also in this state");
            f.AppendLine("But not in this state");
            f.AppendLine("When add a 10");
            f.AppendLine("Then should have <result>:");
            f.AppendLine("| result |");
            f.AppendLine("| 11 |");
            f.AppendLine("| 12 |");

            return(LexerFeature.Create(f.ToString()));
        }