<commit_before>﻿using Evolve.Configuration;
using Evolve.Migration;
using System.Collections.Generic;
using System.Linq;
using Xunit;

namespace Evolve.Test.Configuration
{
    public class AppConfigConfigurationProviderTest
    {
        [Fact(DisplayName = "Load_app_configuration_file_works")]
        public void Load_app_configuration_file_works()
        {
            var evolve = new Evolve();
            var configurationProvider = new AppConfigConfigurationProvider();
            configurationProvider.Configure(TestContext.AppConfigPath, evolve);

            Assert.Equal("Server=127.0.0.1;Port=5432;Database=myDataBase;User Id=myUsername;Password=<PASSWORD>;", evolve.ConnectionString);
            Assert.Equal("npgsql", evolve.Driver);
            Assert.True(new List<string>() { "migration", "dataset" }.SequenceEqual(evolve.Locations));
            Assert.Equal("utf-16", evolve.Encoding.BodyName);
            Assert.Equal("Ver", evolve.SqlMigrationPrefix);
            Assert.Equal("@", evolve.SqlMigrationSeparator);
            Assert.Equal(".query", evolve.SqlMigrationSuffix);
            Assert.Equal("my_shema", evolve.DefaultSchema);
            Assert.Equal("my_metadata_schema", evolve.MetadaTableSchema);
            Assert.Equal("metadata_store", evolve.MetadaTableName);
            Assert.Equal("@{", evolve.PlaceholderPrefix);
            Assert.Equal("@}", evolve.PlaceholderSuffix);
            Assert.Equal(new MigrationVersion("2_1_0"), evolve.TargetVersion);
        }

        [Fact(DisplayName = "Load_web_configuration_file_works")]
        public void Load_web_configuration_file_works()
        {
            var expectedEvolve = new Evolve();
            var evolve = new Evolve();
            var configurationProvider = new AppConfigConfigurationProvider();
            configurationProvider.Configure(TestContext.WebConfigPath, evolve);

            Assert.Equal("Server=127.0.0.1;Port=5432;Database=myDataBase;User Id=myUsername;Password=<PASSWORD>;", evolve.ConnectionString);
            Assert.Equal("npgsql", evolve.Driver);
            Assert.Equal(expectedEvolve.Encoding.BodyName, evolve.Encoding.BodyName);
            Assert.Equal(expectedEvolve.SqlMigrationPrefix, evolve.SqlMigrationPrefix);
            Assert.Equal(expectedEvolve.SqlMigrationSeparator, evolve.SqlMigrationSeparator);
            Assert.Equal(expectedEvolve.SqlMigrationSuffix, evolve.SqlMigrationSuffix);
            Assert.Equal("my_shema", evolve.DefaultSchema);
            Assert.Equal(evolve.DefaultSchema, evolve.MetadaTableSchema);
            Assert.Equal(expectedEvolve.MetadaTableName, evolve.MetadaTableName);
            Assert.Equal(expectedEvolve.PlaceholderPrefix, evolve.PlaceholderPrefix);
            Assert.Equal(expectedEvolve.PlaceholderSuffix, evolve.PlaceholderSuffix);
            Assert.Equal(expectedEvolve.TargetVersion, evolve.TargetVersion);
        }
    }
}<commit_msg>Complete AppConfigConfigurationProvider unit tests<commit_after>﻿using Evolve.Configuration;
using Evolve.Migration;
using System.Collections.Generic;
using System.Linq;
using Xunit;

namespace Evolve.Test.Configuration
{
    public class AppConfigConfigurationProviderTest
    {
        [Fact(DisplayName = "Load_app_configuration_file_works")]
        public void Load_app_configuration_file_works()
        {
            var evolve = new Evolve();
            var configurationProvider = new AppConfigConfigurationProvider();
            configurationProvider.Configure(TestContext.AppConfigPath, evolve);

            Assert.Equal("Server=127.0.0.1;Port=5432;Database=myDataBase;User Id=myUsername;Password=<PASSWORD>;", evolve.ConnectionString);
            Assert.Equal("npgsql", evolve.Driver);
            Assert.True(new List<string>() { "migration", "dataset" }.SequenceEqual(evolve.Locations));
            Assert.Equal("utf-16", evolve.Encoding.BodyName);
            Assert.Equal("Ver", evolve.SqlMigrationPrefix);
            Assert.Equal("@", evolve.SqlMigrationSeparator);
            Assert.Equal(".query", evolve.SqlMigrationSuffix);
            Assert.Equal("my_shema", evolve.DefaultSchema);
            Assert.Equal("my_metadata_schema", evolve.MetadaTableSchema);
            Assert.Equal("metadata_store", evolve.MetadaTableName);
            Assert.Equal("@{", evolve.PlaceholderPrefix);
            Assert.Equal("@}", evolve.PlaceholderSuffix);
            Assert.Equal(new MigrationVersion("2_1_0"), evolve.TargetVersion);
        }

        [Fact(DisplayName = "Load_web_configuration_file_works")]
        public void Load_web_configuration_file_works()
        {
            var expectedEvolve = new Evolve();
            var evolve = new Evolve();
            var configurationProvider = new AppConfigConfigurationProvider();
            configurationProvider.Configure(TestContext.WebConfigPath, evolve);

            Assert.Equal("Server=127.0.0.1;Port=5432;Database=myDataBase;User Id=myUsername;Password=<PASSWORD>;", evolve.ConnectionString);
            Assert.Equal("npgsql", evolve.Driver);
            Assert.NotNull(evolve.Locations);
            Assert.Equal(expectedEvolve.Encoding.BodyName, evolve.Encoding.BodyName);
            Assert.Equal(expectedEvolve.SqlMigrationPrefix, evolve.SqlMigrationPrefix);
            Assert.Equal(expectedEvolve.SqlMigrationSeparator, evolve.SqlMigrationSeparator);
            Assert.Equal(expectedEvolve.SqlMigrationSuffix, evolve.SqlMigrationSuffix);
            Assert.Equal("my_shema", evolve.DefaultSchema);
            Assert.Equal(evolve.DefaultSchema, evolve.MetadaTableSchema);
            Assert.Equal(expectedEvolve.MetadaTableName, evolve.MetadaTableName);
            Assert.Equal(expectedEvolve.PlaceholderPrefix, evolve.PlaceholderPrefix);
            Assert.Equal(expectedEvolve.PlaceholderSuffix, evolve.PlaceholderSuffix);
            Assert.Equal(expectedEvolve.TargetVersion, evolve.TargetVersion);
        }
    }
}
{'fraction_non_alphanumeric': 0.10782169890664424, 'fraction_numerical': 0.008410428931875526, 'mean_word_length': 3.4011843079200594, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 4, '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': '2497833', 'n_tokens_mistral': 1621, 'n_tokens_neox': 1535, 'n_words': 214}