<commit_before>﻿using NUnit.Framework;
using TddBuddy.SpeedyLocalDb.DotNetCore.Construction;

namespace TddBuddy.SpeedySqlLocalDb.DotNetCore.Tests
{
    [TestFixture]
    public class SpeedySqlBuilderTests
    {
        [Test]
        public void Build_WhenConstructedWithMigrationAction_ShouldExecuteMigrationAction()
        {
            //---------------Set up test pack-------------------
            var result = string.Empty;
            var builder = new SpeedySqlBuilder();
            //---------------Execute Test ----------------------
            builder.WithMigrationAction(() =>
            {
                result = "transaction ran";
            });
            builder.BuildWrapper();
            //---------------Test Result -----------------------
            var expected = "transaction ran";
            Assert.AreEqual(expected, result);
        }

        [Test]
        public void Build_WhenConstructedNoWithMigrationAction_ShouldNotThrowException()
        {
            //---------------Set up test pack-------------------
            var builder = new SpeedySqlBuilder();
            //---------------Execute Test ----------------------
            //---------------Test Result -----------------------
            Assert.DoesNotThrow(() => builder.BuildWrapper());
        }
        
        [Test]
        public void Build_WhenConstructedTwiceWithMigrationAction_ShouldExecuteMigrationActionOnce()
        {
            //---------------Set up test pack-------------------
            var result = string.Empty;
            var counter = 1;
            var builder = new SpeedySqlBuilder();
            //---------------Execute Test ----------------------
            builder.WithMigrationAction(() =>
            {
                result = $"transaction ran {counter} time(s)";
                counter++;
            });
            builder.BuildWrapper();
            builder.BuildWrapper();
            //---------------Test Result -----------------------
            var expected = "transaction ran 1 time(s)";
            Assert.AreEqual(expected, result);
        }
    }
}<commit_msg>chore: fixed up test execution issue where each needs a new thread<commit_after>﻿using System.Threading.Tasks;
using NUnit.Framework;
using TddBuddy.SpeedyLocalDb.DotNetCore.Construction;

namespace TddBuddy.SpeedySqlLocalDb.DotNetCore.Tests
{
    [TestFixture]
    public class SpeedySqlBuilderTests
    {
        [Test]
        public void Build_WhenConstructedWithMigrationAction_ShouldExecuteMigrationAction()
        {
            Task.Run(() =>
            {
                //---------------Set up test pack-------------------
                var result = string.Empty;
                var builder = new SpeedySqlBuilder();
                //---------------Execute Test ----------------------
                builder.WithMigrationAction(() => { result = "transaction ran"; });
                builder.BuildWrapper();
                //---------------Test Result -----------------------
                var expected = "transaction ran";
                Assert.AreEqual(expected, result);
            });

        }

        [Test]
        public void Build_WhenConstructedNoWithMigrationAction_ShouldNotThrowException()
        {
            Task.Run(() =>
            {

                //---------------Set up test pack-------------------
                var builder = new SpeedySqlBuilder();
                //---------------Execute Test ----------------------
                //---------------Test Result -----------------------
                Assert.DoesNotThrow(() => builder.BuildWrapper());
            });
            
        }
        
        [Test]
        public void Build_WhenConstructedTwiceWithMigrationAction_ShouldExecuteMigrationActionOnce()
        {
            Task.Run(() =>
            {
                //---------------Set up test pack-------------------
                var result = string.Empty;
                var counter = 1;
                var builder = new SpeedySqlBuilder();
                //---------------Execute Test ----------------------
                builder.WithMigrationAction(() =>
                {
                    result = $"transaction ran {counter} time(s)";
                    counter++;
                });
                builder.BuildWrapper();
                builder.BuildWrapper();
                //---------------Test Result -----------------------
                var expected = "transaction ran 1 time(s)";
                Assert.AreEqual(expected, result);
            });
        }
    }
}
{'fraction_non_alphanumeric': 0.21142008066227977, 'fraction_numerical': 0.0008490766291657822, 'mean_word_length': 0.9865092748735245, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 12, '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': '2372625', 'n_tokens_mistral': 1014, 'n_tokens_neox': 949, 'n_words': 210}