static IntegrationTest()
        {
            var config = new ConfigurationBuilder()
                         .AddEnvironmentVariables()
                         .Build();

            if (config.GetValue("APPVEYOR", false))
            {
                Console.WriteLine($"Running AppVeyor Tests for {typeof(TClass).Name}");

                TestDatabaseProviders = new TheoryData <DbContextOptions <TDbContext> >
                {
                    DatabaseProviderBuilder.BuildInMemory <TDbContext>(typeof(TClass).Name),
                    DatabaseProviderBuilder.BuildSqlite <TDbContext>(typeof(TClass).Name),
                    DatabaseProviderBuilder.BuildAppVeyorSqlServer2016 <TDbContext>(typeof(TClass).Name),
                    //DatabaseProviderBuilder.BuildAppVeyorMySql<TDbContext>(typeof(TClass).Name),
                    //DatabaseProviderBuilder.BuildAppVeyorPostgreSql<TDbContext>(typeof(TClass).Name)
                };
            }
            else
            {
                Console.WriteLine($"Running Local Tests for {typeof(TClass).Name}");

                TestDatabaseProviders = new TheoryData <DbContextOptions <TDbContext> >
                {
                    DatabaseProviderBuilder.BuildInMemory <TDbContext>(typeof(TClass).Name),
                    DatabaseProviderBuilder.BuildSqlite <TDbContext>(typeof(TClass).Name),
                    DatabaseProviderBuilder.BuildLocalDb <TDbContext>(typeof(TClass).Name)
                };
            }
        }
コード例 #2
0
        static IntegrationTest()
        {
            var config = new ConfigurationBuilder()
                         .AddEnvironmentVariables()
                         .Build();

            TestDatabaseProviders = new TheoryData <DbContextOptions <TDbContext> >
            {
                DatabaseProviderBuilder.BuildInMemory <TDbContext>(typeof(TClass).Name)
            };

            if (config.GetValue("APPVEYOR", false))
            {
                Console.WriteLine($"Running AppVeyor Tests for {typeof(TClass).Name}");

                TestDatabaseProviders.Add(DatabaseProviderBuilder.BuildSqlite <TDbContext>(typeof(TClass).Name));

                if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
                {
                    TestDatabaseProviders.Add(DatabaseProviderBuilder.BuildAppVeyorSqlServer2016 <TDbContext>(typeof(TClass).Name));
                }
                else
                {
                    Console.WriteLine("Skipping some SqlServer integration tests because on non-Windows");
                }
            }
            //else
            //{
            //    Console.WriteLine($"Running Local Tests for {typeof(TClass).Name}");

            //    if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
            //    {
            //        TestDatabaseProviders.Add();
            //    }
            //}

            //else
            //{
            //    if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
            //    {
            //        Console.WriteLine($"Running Local Tests for {typeof(TClass).Name}");

            //        TestDatabaseProviders = new TheoryData<DbContextOptions<TDbContext>>
            //        {
            //            DatabaseProviderBuilder.BuildInMemory<TDbContext>(typeof(TClass).Name),
            //            DatabaseProviderBuilder.BuildSqlite<TDbContext>(typeof(TClass).Name),
            //            DatabaseProviderBuilder.BuildLocalDb<TDbContext>(typeof(TClass).Name)
            //        };
            //    }
            //    else
            //    {
            //        TestDatabaseProviders.Add(DatabaseProviderBuilder.BuildInMemory<TDbContext>(typeof(TClass).Name));
            //        Console.WriteLine("Skipping DB integration tests on non-Windows");
            //    }
            //}
        }