public static void MyClassInitialize(TestContext testContext) { using (var db = new CSSDataContext()) { if (db.DatabaseExists() == false) { db.CreateDatabase(); } } }
public void ClearDatabase() { if (_initialized) return; using (var db = new CSSDataContext()) { //Clear data try { db.DeleteDatabase(); } catch(Exception ex) { Debug.WriteLine(ex.ToString()); } db.CreateDatabase(); //Create any other functions which weren't created SetupFunctions(db); //Insert any test data InsertTestData(db); //Submit changes db.SubmitChanges(); _initialized = true; } }