Drop database at start and end of sql tests
This commit is contained in:
parent
de6b7a0a26
commit
00261c1984
|
|
@ -28,16 +28,21 @@ namespace Microsoft.AspNet.Identity.SqlServer.Test
|
||||||
public ApplicationDbContext(IServiceProvider services, IOptionsAccessor<DbContextOptions> options) : base(services, options.Options) { }
|
public ApplicationDbContext(IServiceProvider services, IOptionsAccessor<DbContextOptions> options) : base(services, options.Options) { }
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestPriority(-1)]
|
[TestPriority(-1000)]
|
||||||
[Fact]
|
[Fact]
|
||||||
public void RecreateDatabase()
|
public void DropDatabaseStart()
|
||||||
{
|
{
|
||||||
CreateContext(true);
|
DropDb();
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestPriority(10000)]
|
[TestPriority(10000)]
|
||||||
[Fact]
|
[Fact]
|
||||||
public void DropDatabase()
|
public void DropDatabaseDone()
|
||||||
|
{
|
||||||
|
DropDb();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void DropDb()
|
||||||
{
|
{
|
||||||
var services = new ServiceCollection();
|
var services = new ServiceCollection();
|
||||||
services.AddEntityFramework().AddSqlServer();
|
services.AddEntityFramework().AddSqlServer();
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@ namespace Microsoft.AspNet.Identity.SqlServer.Test
|
||||||
[TestCaseOrderer("Microsoft.AspNet.Identity.Test.PriorityOrderer", "Microsoft.AspNet.Identity.SqlServer.Test")]
|
[TestCaseOrderer("Microsoft.AspNet.Identity.Test.PriorityOrderer", "Microsoft.AspNet.Identity.SqlServer.Test")]
|
||||||
public class UserStoreTest : UserManagerTestBase<IdentityUser, IdentityRole>
|
public class UserStoreTest : UserManagerTestBase<IdentityUser, IdentityRole>
|
||||||
{
|
{
|
||||||
private const string ConnectionString = @"Server=(localdb)\v11.0;Database=SqlUserStoreTest;Trusted_Connection=True;";
|
private static readonly string ConnectionString = @"Server=(localdb)\v11.0;Database=SqlUserStoreTest;Trusted_Connection=True;";
|
||||||
|
|
||||||
public class ApplicationUser : IdentityUser { }
|
public class ApplicationUser : IdentityUser { }
|
||||||
|
|
||||||
|
|
@ -30,16 +30,21 @@ namespace Microsoft.AspNet.Identity.SqlServer.Test
|
||||||
public ApplicationDbContext(IServiceProvider services, IOptionsAccessor<DbContextOptions> options) : base(services, options.Options) { }
|
public ApplicationDbContext(IServiceProvider services, IOptionsAccessor<DbContextOptions> options) : base(services, options.Options) { }
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestPriority(-1)]
|
[TestPriority(-1000)]
|
||||||
[Fact]
|
[Fact]
|
||||||
public void RecreateDatabase()
|
public void DropDatabaseStart()
|
||||||
{
|
{
|
||||||
CreateContext(true);
|
DropDb();
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestPriority(10000)]
|
[TestPriority(10000)]
|
||||||
[Fact]
|
[Fact]
|
||||||
public void DropDatabase()
|
public void DropDatabaseDone()
|
||||||
|
{
|
||||||
|
DropDb();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void DropDb()
|
||||||
{
|
{
|
||||||
var services = new ServiceCollection();
|
var services = new ServiceCollection();
|
||||||
services.AddEntityFramework().AddSqlServer();
|
services.AddEntityFramework().AddSqlServer();
|
||||||
|
|
@ -126,7 +131,7 @@ namespace Microsoft.AspNet.Identity.SqlServer.Test
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static IdentityDbContext CreateContext(bool delete = false)
|
public IdentityDbContext CreateContext(bool delete = false)
|
||||||
{
|
{
|
||||||
var services = new ServiceCollection();
|
var services = new ServiceCollection();
|
||||||
services.AddEntityFramework().AddSqlServer();
|
services.AddEntityFramework().AddSqlServer();
|
||||||
|
|
@ -146,12 +151,12 @@ namespace Microsoft.AspNet.Identity.SqlServer.Test
|
||||||
return CreateContext();
|
return CreateContext();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void EnsureDatabase()
|
public void EnsureDatabase()
|
||||||
{
|
{
|
||||||
CreateContext();
|
CreateContext();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ApplicationDbContext CreateAppContext()
|
public ApplicationDbContext CreateAppContext()
|
||||||
{
|
{
|
||||||
CreateContext();
|
CreateContext();
|
||||||
var services = new ServiceCollection();
|
var services = new ServiceCollection();
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue