public void TestFixtureSetUp() { var localDb = new SqlLocalDbApiWrapper(); if (!localDb.IsLocalDBInstalled()) { throw new Exception("LocalDB is not installed!"); } this.instance = TemporarySqlLocalDbInstance.Create(deleteFiles: true); // Initialize database var strategy = new DropCreateDatabaseAlways <SentinelContext>(); Database.SetInitializer(strategy); var builder = this.instance.CreateConnectionStringBuilder(); // Update the connection string to specify the name of the database // and its physical location to the current application directory builder.SetInitialCatalogName("SentinelAuth"); builder.SetPhysicalFileName(@".\SentinelAuth.mdf"); this.connectionString = builder.ConnectionString; using (var context = new SentinelContext(this.connectionString)) { context.Database.Initialize(true); } }
public void TestFixtureSetUp() { var localDb = new SqlLocalDbApiWrapper(); if (!localDb.IsLocalDBInstalled()) { throw new Exception("LocalDB is not installed!"); } this.instance = TemporarySqlLocalDbInstance.Create(deleteFiles: true); // Initialize database var strategy = new DropCreateDatabaseAlways<SentinelContext>(); Database.SetInitializer(strategy); var builder = this.instance.CreateConnectionStringBuilder(); // Update the connection string to specify the name of the database // and its physical location to the current application directory builder.SetInitialCatalogName("SentinelAuth"); builder.SetPhysicalFileName(@".\SentinelAuth.mdf"); this.connectionString = builder.ConnectionString; using (var context = new SentinelContext(this.connectionString)) { context.Database.Initialize(true); } }