<commit_before>﻿// <copyright>
// Copyright (c) <NAME>. All rights reserved.
// Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
// </copyright>

namespace FixieSpec.Specifications
{
    using Shouldly;

    public sealed class SuccessfulSpecificationExecution : FixieSpecSpecificationBase
    {
        SpecificationExecutionResult successfulExecutionResult;

        public void When_executing_a_sucessful_specification()
        {
            successfulExecutionResult = Execute<SuccessfulSpecification>();
        }

        public void Then_all_specifiction_steps_should_execute_in_order()
        {
            successfulExecutionResult.ConsoleOutput.ShouldEqual(
                "Given_a_specification_context",
                "And_given_a_secondary_specification_context",
                "When_exercising_the_system_under_test",
                "And_when_exercising_the_system_under_test_some_more",
                "Then_a_result_can_be_verified",
                "And_then_another_result_can_be_verified");
        }

        public void And_then_all_specification_steps_should_be_recognized()
        {
            successfulExecutionResult.Total.ShouldBe(2);
        }

        public void And_then_all_successful_assertion_steps_should_be_recognized()
        {
            successfulExecutionResult.Passed.ShouldBe(2);
        }

        public void And_then_there_should_be_no_failed_assertion_steps()
        {
            successfulExecutionResult.Failed.ShouldBe(0);
        }

        class SuccessfulSpecification
        {
            public void Given_a_specification_context()
            {
                WhereAmI();
            }

            public void And_given_a_secondary_specification_context()
            {
                WhereAmI();
            }

            public void When_exercising_the_system_under_test()
            {
                WhereAmI();
            }

            public void And_when_exercising_the_system_under_test_some_more()
            {
                WhereAmI();
            }

            public void Then_a_result_can_be_verified()
            {
                WhereAmI();
            }

            public void And_then_another_result_can_be_verified()
            {
                WhereAmI();
            }
        }
    }
}<commit_msg>Improved SuccessfulSpecificationExecution to also pass instance values from setup steps to transition steps to assertion steps<commit_after>﻿// <copyright>
// Copyright (c) <NAME>. All rights reserved.
// Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
// </copyright>

namespace FixieSpec.Specifications
{
    using Shouldly;

    public sealed class SuccessfulSpecificationExecution : FixieSpecSpecificationBase
    {
        SpecificationExecutionResult successfulExecutionResult;

        public void When_executing_a_sucessful_specification()
        {
            successfulExecutionResult = Execute<SuccessfulSpecification>();
        }

        public void Then_all_specifiction_steps_should_execute_in_order()
        {
            successfulExecutionResult.ConsoleOutput.ShouldEqual(
                "Given_a_specification_context",
                "And_given_a_secondary_specification_context",
                "When_exercising_the_system_under_test",
                "And_when_exercising_the_system_under_test_some_more",
                "Then_a_result_can_be_verified",
                "And_then_another_result_can_be_verified");
        }

        public void And_then_all_specification_steps_should_be_recognized()
        {
            successfulExecutionResult.Total.ShouldBe(2);
        }

        public void And_then_all_successful_assertion_steps_should_be_recognized()
        {
            successfulExecutionResult.Passed.ShouldBe(2);
        }

        public void And_then_there_should_be_no_failed_assertion_steps()
        {
            successfulExecutionResult.Failed.ShouldBe(0);
        }

        class SuccessfulSpecification
        {
            const int SomeValue = 42;
            const int SomeOtherValue = 4711;

            SpecificationContext systemUnderTest;

            public void Given_a_specification_context()
            {
                systemUnderTest = new SpecificationContext();
                WhereAmI();
            }

            public void And_given_a_secondary_specification_context()
            {
                WhereAmI();
            }

            public void When_exercising_the_system_under_test()
            {
                systemUnderTest.Value = SomeValue;
                WhereAmI();
            }

            public void And_when_exercising_the_system_under_test_some_more()
            {
                systemUnderTest.AnotherValue = SomeOtherValue;
                WhereAmI();
            }

            public void Then_a_result_can_be_verified()
            {
                systemUnderTest.Value.ShouldBe(SomeValue);
                WhereAmI();
            }

            public void And_then_another_result_can_be_verified()
            {
                systemUnderTest.AnotherValue.ShouldBe(SomeOtherValue);
                WhereAmI();
            }

            class SpecificationContext
            {
                public int Value { get; set; }
                public int AnotherValue { get; set; }
            }
        }
    }
}
{'fraction_non_alphanumeric': 0.05823994120889216, 'fraction_numerical': 0.002204666544185192, 'mean_word_length': 1.9635274904735982, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3835277', 'n_tokens_mistral': 1437, 'n_tokens_neox': 1364, 'n_words': 224}