<commit_before>//-------------------------------------------------------------------------------
// <copyright file="HierarchicalStateMachineInitialization.cs" company="Appccelerate">
//   Copyright (c) 2008-2017 Appccelerate
//
//   Licensed under the Apache License, Version 2.0 (the "License");
//   you may not use this file except in compliance with the License.
//   You may obtain a copy of the License at
//
//       http://www.apache.org/licenses/LICENSE-2.0
//
//   Unless required by applicable law or agreed to in writing, software
//   distributed under the License is distributed on an "AS IS" BASIS,
//   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//   See the License for the specific language governing permissions and
//   limitations under the License.
// </copyright>
//-------------------------------------------------------------------------------

namespace Appccelerate.StateMachine.Specs.Sync
{
    using FluentAssertions;
    using Xbehave;

    public class HierarchicalStateMachineInitialization
    {
        private const int LeafState = 1;
        private const int SuperState = 0;

        private CurrentStateExtension testExtension;
        private PassiveStateMachine<int, int> machine;

        private bool entryActionOfLeafStateExecuted;
        private bool entryActionOfSuperStateExecuted;

        [Background]
        public void Background()
        {
            "establish a hierarchical state machine".x(() =>
                {
                    this.testExtension = new CurrentStateExtension();

                    this.machine = new PassiveStateMachine<int, int>();

                    this.machine.AddExtension(this.testExtension);

                    this.machine.DefineHierarchyOn(SuperState)
                        .WithHistoryType(HistoryType.None)
                        .WithInitialSubState(LeafState);

                    this.machine.In(SuperState)
                        .ExecuteOnEntry(() => this.entryActionOfSuperStateExecuted = true);
                    this.machine.In(LeafState)
                        .ExecuteOnEntry(() => this.entryActionOfLeafStateExecuted = true);
                });<commit_msg>fix HierarchicalStateMachineInitialization Specs<commit_after>//-------------------------------------------------------------------------------
// <copyright file="HierarchicalStateMachineInitialization.cs" company="Appccelerate">
//   Copyright (c) 2008-2017 Appccelerate
//
//   Licensed under the Apache License, Version 2.0 (the "License");
//   you may not use this file except in compliance with the License.
//   You may obtain a copy of the License at
//
//       http://www.apache.org/licenses/LICENSE-2.0
//
//   Unless required by applicable law or agreed to in writing, software
//   distributed under the License is distributed on an "AS IS" BASIS,
//   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//   See the License for the specific language governing permissions and
//   limitations under the License.
// </copyright>
//-------------------------------------------------------------------------------

namespace Appccelerate.StateMachine.Specs.Sync
{
    using FluentAssertions;
    using Machine;
    using Xbehave;

    public class HierarchicalStateMachineInitialization
    {
        private const int LeafState = 1;
        private const int SuperState = 0;

        private readonly CurrentStateExtension testExtension = new CurrentStateExtension();
        private PassiveStateMachine<int, int> machine;

        private bool entryActionOfLeafStateExecuted;
        private bool entryActionOfSuperStateExecuted;

        [Background]
        public void Background()
        {
            "establish a hierarchical state machine".x(() =>
            {
                this.machine = new StateMachineDefinitionBuilder<int, int>()
                    .WithConfiguration(x =>
                        x.DefineHierarchyOn(SuperState)
                            .WithHistoryType(HistoryType.None)
                            .WithInitialSubState(LeafState))
                    .WithConfiguration(x =>
                        x.In(SuperState)
                            .ExecuteOnEntry(() => this.entryActionOfSuperStateExecuted = true))
                    .WithConfiguration(x =>
                        x.In(LeafState)
                            .ExecuteOnEntry(() => this.entryActionOfLeafStateExecuted = true))
                    .Build()
                    .CreatePassiveStateMachine();

                this.machine.AddExtension(this.testExtension);
            });
{'fraction_non_alphanumeric': 0.1447396845971052, 'fraction_numerical': 0.006048822639879024, 'mean_word_length': 1.7575938058368077, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 20, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '423279', 'n_tokens_mistral': 1082, 'n_tokens_neox': 1022, 'n_words': 303}