<commit_before>﻿// <copyright file="StepRunner.cs" company="xBehave.net contributors">
//  Copyright (c) xBehave.net contributors. All rights reserved.
// </copyright>

namespace Xbehave.Execution
{
    using System;
    using System.Globalization;
    using System.Linq;
    using System.Reflection;
    using System.Threading;
    using System.Threading.Tasks;
    using Xbehave.Sdk;
    using Xunit.Sdk;

    public class StepRunner : TestRunner<IXunitTestCase>
    {
        private readonly string stepName;
        private readonly Func<Task> body;

        public StepRunner(
            Step step,
            IXunitTestCase testCase,
            IMessageBus messageBus,
            Type testClass,
            object[] constructorArguments,
            MethodInfo testMethod,
            object[] testMethodArguments,
            string displayName,
            string skipReason,
            ExceptionAggregator aggregator,
            CancellationTokenSource cancellationTokenSource)
            : base(
                testCase,
                messageBus,
                testClass,
                constructorArguments,
                testMethod,
                testMethodArguments,
                displayName,
                skipReason,
                aggregator,
                cancellationTokenSource)
        {
            Guard.AgainstNullArgument("step", step);

            try
            {
                this.stepName = string.Format(CultureInfo.InvariantCulture, step.Name, testMethodArguments);
            }
            catch (FormatException)
            {
                this.stepName = step.Name;
            }

            this.body = step.Body;
            this.DisplayName = string.Format(CultureInfo.InvariantCulture, "{0} {1}", this.DisplayName, this.stepName);
        }

        public string StepName
        {
            get { return this.stepName; }
        }

        protected override async Task<decimal> InvokeTestAsync(ExceptionAggregator aggregator)
        {
            var timer = new ExecutionTimer();
            await aggregator.RunAsync(this.body);
            return timer.Total;
        }
    }
}
<commit_msg>green: implemented ExampleFeature.FormattedStepsWithNullValues in v2<commit_after>﻿// <copyright file="StepRunner.cs" company="xBehave.net contributors">
//  Copyright (c) xBehave.net contributors. All rights reserved.
// </copyright>

namespace Xbehave.Execution
{
    using System;
    using System.Globalization;
    using System.Linq;
    using System.Reflection;
    using System.Threading;
    using System.Threading.Tasks;
    using Xbehave.Sdk;
    using Xunit.Sdk;

    public class StepRunner : TestRunner<IXunitTestCase>
    {
        private readonly string stepName;
        private readonly Func<Task> body;

        public StepRunner(
            Step step,
            IXunitTestCase testCase,
            IMessageBus messageBus,
            Type testClass,
            object[] constructorArguments,
            MethodInfo testMethod,
            object[] testMethodArguments,
            string displayName,
            string skipReason,
            ExceptionAggregator aggregator,
            CancellationTokenSource cancellationTokenSource)
            : base(
                testCase,
                messageBus,
                testClass,
                constructorArguments,
                testMethod,
                testMethodArguments,
                displayName,
                skipReason,
                aggregator,
                cancellationTokenSource)
        {
            Guard.AgainstNullArgument("step", step);

            try
            {
                this.stepName = string.Format(
                    CultureInfo.InvariantCulture,
                    step.Name,
                    testMethodArguments.Select(argument => argument ?? "null").ToArray());
            }
            catch (FormatException)
            {
                this.stepName = step.Name;
            }

            this.body = step.Body;
            this.DisplayName = string.Format(CultureInfo.InvariantCulture, "{0} {1}", this.DisplayName, this.stepName);
        }

        public string StepName
        {
            get { return this.stepName; }
        }

        protected override async Task<decimal> InvokeTestAsync(ExceptionAggregator aggregator)
        {
            var timer = new ExecutionTimer();
            await aggregator.RunAsync(this.body);
            return timer.Total;
        }
    }
}

{'fraction_non_alphanumeric': 0.07084585659081151, 'fraction_numerical': 0.00107342206955775, 'mean_word_length': 1.5238353196099674, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 14, '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': '6872259', 'n_tokens_mistral': 1111, 'n_tokens_neox': 1078, 'n_words': 241}