You can solve this by overriding Dispose method in your Test DbContext class: :)
public class TestDbContext : DbContext { public TestDbContext() : base("Name=TestConnection") {
}
...... protected override void Dispose(bool disposing) { Dispose(); base.Dispose(disposing); } }