public TestDBCreator() { try { TestDataContext = new Context(CreateNewRandomDBConnectionString()); TestDataContext.Database.CreateIfNotExists(); InitializeData(); } catch (Exception) { // Cleans up the database if something fails since the TestDBCreator is often created in the testInitialize method // and TestCleanup is not ran if the TestInitialize throws an exception Cleanup(); throw; } }
public void TestInitialize() { _testDBCreator = new TestDBCreator(); _testDataContext = _testDBCreator.TestDataContext; }