diff --git a/appveyor.yml b/appveyor.yml index 3ece2bd..ad5b79c 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -3,9 +3,6 @@ image: Visual Studio 2017 cache: - packages -> **\packages.config -before_build: - - ps: sqllocaldb c "v12.0" 12.0 -s - build_script: - ./build.cmd /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll" diff --git a/tests/Filter.Tests/Filter.Tests.csproj b/tests/Filter.Tests/Filter.Tests.csproj index 37246eb..0d09a75 100755 --- a/tests/Filter.Tests/Filter.Tests.csproj +++ b/tests/Filter.Tests/Filter.Tests.csproj @@ -42,13 +42,12 @@ ..\..\packages\EntityFramework.6.1.3\lib\net45\EntityFramework.SqlServer.dll True - - ..\..\packages\RimDev.Automation.Sql.0.2.0\lib\net45\RimDev.Automation.Sql.dll - True - + + ..\..\packages\System.Data.SqlLocalDb.1.15.0\lib\net40\System.Data.SqlLocalDb.dll + diff --git a/tests/Filter.Tests/Generic/Integration/DatabaseFixture.cs b/tests/Filter.Tests/Generic/Integration/DatabaseFixture.cs index 42717bd..9b556b8 100644 --- a/tests/Filter.Tests/Generic/Integration/DatabaseFixture.cs +++ b/tests/Filter.Tests/Generic/Integration/DatabaseFixture.cs @@ -1,25 +1,35 @@ using System; -using System.Threading; -using RimDev.Automation.Sql; -using RimDev.Filter.Tests.Extensions; +using System.Data.Common; +using System.Data.SqlLocalDb; namespace RimDev.Filter.Tests.Generic.Integration { - public sealed class DatabaseFixture : IDisposable + public class DatabaseFixture : IDisposable { - private readonly Lazy lazyDatabase; + private readonly Lazy lazyInstance; public DatabaseFixture() { - lazyDatabase = new Lazy( - () => new LocalDb(version: "v12.0"), LazyThreadSafetyMode.ExecutionAndPublication); + lazyInstance = new Lazy( + () => TemporarySqlLocalDbInstance.Create(true)); } - public string ConnectionString => lazyDatabase.Value.ConnectionString; - + public DbConnectionStringBuilder CreateConnectionStringBuilder() + { + var instance = lazyInstance.Value; + + var builder = lazyInstance.Value.CreateConnectionStringBuilder(); + builder.SetInitialCatalogName(Guid.NewGuid().ToString("N")); + + return builder; + } + + public string ConnectionString => CreateConnectionStringBuilder().ConnectionString; + public void Dispose() { - lazyDatabase.Dispose(); + if (lazyInstance.IsValueCreated) + lazyInstance.Value.Dispose(); } } } diff --git a/tests/Filter.Tests/packages.config b/tests/Filter.Tests/packages.config index e21d0b4..8a00904 100755 --- a/tests/Filter.Tests/packages.config +++ b/tests/Filter.Tests/packages.config @@ -1,7 +1,7 @@  - +