public static void ClassInitialize(TestContext testContext) { path = Path.Combine(new FileInfo(typeof(DBTests).Assembly.Location).Directory.FullName, "UnitTestData.mdf"); if (File.Exists(path)) { File.Delete(path); } DatabaseUtil.CreateSqlDatabase(path); conn = new SqlConnection(connstr + path); conn.Open(); var cmd = conn.CreateCommand(); cmd.CommandText = OgcConformanceMap.DropTables; cmd.ExecuteNonQuery(); cmd.CommandText = OgcConformanceMap.CreateTables; cmd.ExecuteNonQuery(); cmd.CommandText = OgcConformanceMap.CreateRows; cmd.ExecuteNonQuery(); }
public static void ClassInitialize(TestContext testContext) { _path = Path.Combine(new FileInfo(typeof(HierarchyDbTests).Assembly.Location).Directory.FullName, "HierarchyUnitTestData.mdf"); if (File.Exists(_path)) { File.Delete(_path); } DatabaseUtil.CreateSqlDatabase(_path); using (var conn = new SqlConnection(DataSource + _path)) { conn.Open(); var cmd = conn.CreateCommand(); cmd.CommandText = "CREATE TABLE [dbo].[TreeNode]([Id] [int] IDENTITY(1,1) NOT NULL, [Route] [hierarchyid] NOT NULL);"; cmd.ExecuteNonQuery(); conn.Close(); } _connection = new SqlConnection(ConnectionString); _connection.Open(); }