<commit_before>namespace Xbehave.Execution
{
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Threading;
    using System.Threading.Tasks;
    using Xbehave.Execution.Extensions;
    using Xunit.Abstractions;
    using Xunit.Sdk;

    public class ScenarioOutlineTestCaseRunner : XunitTestCaseRunner
    {
        private static readonly object[] noArguments = new object[0];

        private readonly IMessageSink diagnosticMessageSink;
        private readonly ExceptionAggregator cleanupAggregator = new ExceptionAggregator();
        private readonly List<ScenarioRunner> scenarioRunners = new List<ScenarioRunner>();
        private readonly List<IDisposable> disposables = new List<IDisposable>();
        private Exception dataDiscoveryException;

        public ScenarioOutlineTestCaseRunner(
            IMessageSink diagnosticMessageSink,
            IXunitTestCase scenarioOutline,
            string displayName,
            string skipReason,
            object[] constructorArguments,
            IMessageBus messageBus,
            ExceptionAggregator aggregator,
            CancellationTokenSource cancellationTokenSource)
            : base(
                scenarioOutline,
                displayName,
                skipReason,
                constructorArguments,
                noArguments,
                messageBus,
                aggregator,
                cancellationTokenSource)
        {
            this.diagnosticMessageSink = diagnosticMessageSink;
        }

        protected override async Task AfterTestCaseStartingAsync()
        {
            await base.AfterTestCaseStartingAsync();

            try
            {
                var dataAttributes = this.TestCase.TestMethod.Method.GetCustomAttributes(typeof(DataAttribute)).ToList();
                foreach (var dataAttribute in dataAttributes)
                {
                    var discovererAttribute = dataAttribute.GetCustomAttributes(typeof(DataDiscovererAttribute)).First();
                    var discoverer =
                        ExtensibilityPointFactory.GetDataDiscoverer(this.diagnosticMessageSink, discovererAttribute);

                    foreach (var dataRow in discoverer.GetData(dataAttribute, this.TestCase.TestMethod.Method))
                    {
                        this.disposables.AddRange(dataRow.OfType<IDisposable>());

                        var info = new ScenarioInfo(TestCase.TestMethod.Method, dataRow, DisplayName);
                        var methodToRun = info.MethodToRun;
                        var convertedDataRow = info.ConvertedDataRow.ToArray();

                        var theoryDisplayName = info.ScenarioDisplayName;
                        var test = new Scenario(TestCase, theoryDisplayName);
                        var skipReason = this.SkipReason ?? dataAttribute.GetNamedArgument<string>("Skip");
                        scenarioRunners.Add(new ScenarioRunner(test, MessageBus, TestClass, ConstructorArguments, methodToRun, convertedDataRow, skipReason, BeforeAfterAttributes, Aggregator, CancellationTokenSource));
                    }
                }

                if (!this.scenarioRunners.Any())
                {
                    var info = new ScenarioInfo(TestCase.TestMethod.Method, noArguments, DisplayName);
                    var methodToRun = info.MethodToRun;
                    var convertedDataRow = info.ConvertedDataRow.ToArray();

                    var theoryDisplayName = info.ScenarioDisplayName;
                    var test = new Scenario(TestCase, theoryDisplayName);
                    this.scenarioRunners.Add(new ScenarioRunner(test, MessageBus, TestClass, ConstructorArguments, methodToRun, convertedDataRow, SkipReason, BeforeAfterAttributes, Aggregator, CancellationTokenSource));
                }
            }
#pragma warning disable CA1031 // Do not catch general exception types
            catch (Exception ex)
            {
                this.dataDiscoveryException = ex;
            }
#pragma warning restore CA1031 // Do not catch general exception types
        }

        protected override async Task<RunSummary> RunTestAsync()
        {<commit_msg>clean up compiler warning restorations<commit_after>namespace Xbehave.Execution
{
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Threading;
    using System.Threading.Tasks;
    using Xbehave.Execution.Extensions;
    using Xunit.Abstractions;
    using Xunit.Sdk;

    public class ScenarioOutlineTestCaseRunner : XunitTestCaseRunner
    {
        private static readonly object[] noArguments = new object[0];

        private readonly IMessageSink diagnosticMessageSink;
        private readonly ExceptionAggregator cleanupAggregator = new ExceptionAggregator();
        private readonly List<ScenarioRunner> scenarioRunners = new List<ScenarioRunner>();
        private readonly List<IDisposable> disposables = new List<IDisposable>();
        private Exception dataDiscoveryException;

        public ScenarioOutlineTestCaseRunner(
            IMessageSink diagnosticMessageSink,
            IXunitTestCase scenarioOutline,
            string displayName,
            string skipReason,
            object[] constructorArguments,
            IMessageBus messageBus,
            ExceptionAggregator aggregator,
            CancellationTokenSource cancellationTokenSource)
            : base(
                scenarioOutline,
                displayName,
                skipReason,
                constructorArguments,
                noArguments,
                messageBus,
                aggregator,
                cancellationTokenSource)
        {
            this.diagnosticMessageSink = diagnosticMessageSink;
        }

        protected override async Task AfterTestCaseStartingAsync()
        {
            await base.AfterTestCaseStartingAsync();

            try
            {
                var dataAttributes = this.TestCase.TestMethod.Method.GetCustomAttributes(typeof(DataAttribute)).ToList();
                foreach (var dataAttribute in dataAttributes)
                {
                    var discovererAttribute = dataAttribute.GetCustomAttributes(typeof(DataDiscovererAttribute)).First();
                    var discoverer =
                        ExtensibilityPointFactory.GetDataDiscoverer(this.diagnosticMessageSink, discovererAttribute);

                    foreach (var dataRow in discoverer.GetData(dataAttribute, this.TestCase.TestMethod.Method))
                    {
                        this.disposables.AddRange(dataRow.OfType<IDisposable>());

                        var info = new ScenarioInfo(TestCase.TestMethod.Method, dataRow, DisplayName);
                        var methodToRun = info.MethodToRun;
                        var convertedDataRow = info.ConvertedDataRow.ToArray();

                        var theoryDisplayName = info.ScenarioDisplayName;
                        var test = new Scenario(TestCase, theoryDisplayName);
                        var skipReason = this.SkipReason ?? dataAttribute.GetNamedArgument<string>("Skip");
                        scenarioRunners.Add(new ScenarioRunner(test, MessageBus, TestClass, ConstructorArguments, methodToRun, convertedDataRow, skipReason, BeforeAfterAttributes, Aggregator, CancellationTokenSource));
                    }
                }

                if (!this.scenarioRunners.Any())
                {
                    var info = new ScenarioInfo(TestCase.TestMethod.Method, noArguments, DisplayName);
                    var methodToRun = info.MethodToRun;
                    var convertedDataRow = info.ConvertedDataRow.ToArray();

                    var theoryDisplayName = info.ScenarioDisplayName;
                    var test = new Scenario(TestCase, theoryDisplayName);
                    this.scenarioRunners.Add(new ScenarioRunner(test, MessageBus, TestClass, ConstructorArguments, methodToRun, convertedDataRow, SkipReason, BeforeAfterAttributes, Aggregator, CancellationTokenSource));
                }
            }
#pragma warning disable CA1031 // Do not catch general exception types
            catch (Exception ex)
#pragma warning restore CA1031 // Do not catch general exception types
            {
                this.dataDiscoveryException = ex;
            }
        }

        protected override async Task<RunSummary> RunTestAsync()
        {
{'fraction_non_alphanumeric': 0.06241872561768531, 'fraction_numerical': 0.002127911100602908, 'mean_word_length': 2.0954994511525795, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 17, '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': '7655980', 'n_tokens_mistral': 1909, 'n_tokens_neox': 1856, 'n_words': 426}