using Pinwheel.Data; namespace IntegrationTests.Data { public class DatabaseTestClass { public static string ConnectionString { get { return System.Configuration.ConfigurationManager .ConnectionStrings[LinqToSqlDataService.DEFAULT_CONNECTION_NAME] .ConnectionString; } } public static void ResetDatabase() { using (var context = new AwardsRepositoryDataContext(ConnectionString)) { // Delete the database if it exists if(context.DatabaseExists()) context.DeleteDatabase(); // Then create a new one context.CreateDatabase(); // Then let go of the connection to avoid any tie-ups context.Connection.Close(); } } } }