You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
EntityFrameworkCore.Jet/test/EFCore.Jet.Integration.Test/AssemblyInitialization.cs

50 lines
1.2 KiB
C#

using System;
using System.Data.Common;
using System.Data.Jet;
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace EFCore.Jet.Integration.Test
{
[TestClass]
public class AssemblyInitialization
{
public static DbConnection Connection;
[AssemblyInitialize]
static public void AssemblyInitialize(TestContext testContext)
{
// This is the only reason why we include the Provider
JetConfiguration.ShowSqlStatements = true;
JetConfiguration.UseConnectionPooling = false;
Connection = Helpers.GetJetConnection();
#if NETFRAMEWORK
Helpers.DeleteSqlCeDatabase();
Helpers.CreateSqlCeDatabase();
#elif NETCOREAPP
// SqlCe does not currently support .NET Core, so don't do anything for AssemblyInitialization
#else
throw new PlatformNotSupportedException();
#endif
}
[AssemblyCleanup]
static public void AssemblyCleanup()
{
if (Connection != null)
Connection.Dispose();
Helpers.DeleteSqlCeDatabase();
JetConnection.ClearAllPools();
}
}
}