I am running some integration tests against a database. I want to setup the database with seed data, run my tests, and then delete the database for every test (so each test has a fresh slate). I'm currently using these setup/teardown methods to do it:
private ProjectDbContext db;
[TestInitialize]
public void SetUp()
{
db = new ProjectDbContext("TestConnection");
(new SeedData()).Run(db); //Seed Data
}
[TestCleanup]
public void Teardown()
{
db.Database.Delete();
db.Dispose();
}
My problem is that it takes a little over a half second per test and I'd like to see better performance. Any thoughts? Anyone have a better strategy?