From 29246b5921cd34cc07c053141f7a4caba5a722e8 Mon Sep 17 00:00:00 2001 From: Tim Abell Date: Tue, 18 Aug 2015 08:53:48 +0100 Subject: [PATCH] tests - don't drop non-existent db in setup contribution from PR #33 - Svein Helge extended the contribution to cover both test classes --- EfEnumToLookupTests/Tests/TestConfiguration.cs | 5 ++++- EfEnumToLookupTests/Tests/TestStuff.cs | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/EfEnumToLookupTests/Tests/TestConfiguration.cs b/EfEnumToLookupTests/Tests/TestConfiguration.cs index 4d4b17e..4a9aeaa 100644 --- a/EfEnumToLookupTests/Tests/TestConfiguration.cs +++ b/EfEnumToLookupTests/Tests/TestConfiguration.cs @@ -16,7 +16,10 @@ public void SetUp() // Using setup rather than teardown to make it easier to inspect the database after running a test. using (var context = new MagicContext()) { - context.Database.Delete(); + if (context.Database.Exists()) + { + context.Database.Delete(); + } } } diff --git a/EfEnumToLookupTests/Tests/TestStuff.cs b/EfEnumToLookupTests/Tests/TestStuff.cs index d8f10b0..b6393b7 100644 --- a/EfEnumToLookupTests/Tests/TestStuff.cs +++ b/EfEnumToLookupTests/Tests/TestStuff.cs @@ -19,7 +19,10 @@ public void SetUp() // Using setup rather than teardown to make it easier to inspect the database after running a test. using (var context = new MagicContext()) { - context.Database.Delete(); + if (context.Database.Exists()) + { + context.Database.Delete(); + } } Database.SetInitializer(new TestInitializer(new EnumToLookup()));