public void CreateOpenDropTable() { DropTables(this.regex); try { Ns.OpenTable("table_does_not_exists"); Assert.Fail(); } catch (TableNotFoundException) { } catch { Assert.Fail(); } Assert.IsFalse(Ns.TableExists("test-1")); Assert.IsFalse(Ns.TableExists("Test-2")); Assert.IsFalse(Ns.TableExists("test-3")); const string Schema = "<Schema><AccessGroup name=\"default\">" + "<ColumnFamily><Name>a</Name></ColumnFamily>" + "</AccessGroup></Schema>"; Ns.CreateTable("test-1", Schema); Assert.IsTrue(Ns.TableExists("test-1")); using (var table = Ns.OpenTable("test-1")) { Assert.AreEqual(table.Name, Ns.Name + "/test-1"); } Ns.CreateTableLike("Test-2", "test-1"); Assert.IsTrue(Ns.TableExists("Test-2")); Ns.CreateTableLike("Test-2", "test-1", CreateDispositions.CreateIfNotExist); Assert.IsFalse(Ns.TableExists("test-2")); // case sensitive using (var table = Ns.OpenTable("Test-2")) { Assert.AreEqual(table.Name, Ns.Name + "/Test-2"); } Ns.CreateTable("test-3", Ns.GetTableSchema("test-1"), CreateDispositions.CreateIfNotExist); Assert.IsTrue(Ns.TableExists("test-3")); using (var table = Ns.OpenTable("test-3")) { Assert.AreEqual(table.Name, Ns.Name + "/test-3"); } var tables = Ns.Tables; Assert.IsTrue(tables.Contains("test-1")); Assert.IsTrue(tables.Contains("Test-2")); Assert.IsTrue(tables.Contains("test-3")); try { Ns.CreateTableLike("Test-2", "test-1"); Assert.Fail(); } catch (TableExistsException) { } catch { Assert.Fail(); } try { Ns.CreateNamespace("test-1"); Assert.Fail(); } catch (NameAlreadyInUseException) { } catch { Assert.Fail(); } const string Schema2 = "<Schema><AccessGroup name=\"default\">" + "<ColumnFamily id=\"2\"><Name>a</Name></ColumnFamily>" + "<ColumnFamily id=\"1\"><Name>b</Name></ColumnFamily>" + "</AccessGroup></Schema>"; Ns.CreateTable("test-4", Schema2); Assert.IsTrue(Ns.TableExists("test-4")); using (var table = Ns.OpenTable("test-4")) { Assert.AreEqual("test/test-4", table.Name); Assert.AreEqual(2, table.GetTableSchema().AccessGroups.First().ColumnFamilies.First(cf => cf.Name == "a").Id); } const string Schema3 = "<Schema><AccessGroup name=\"default\">" + "<ColumnFamily id='2'><Name>a</Name></ColumnFamily>" + "<ColumnFamily id='3'><Name>b</Name></ColumnFamily>" + "<ColumnFamily id='1'><Name>c</Name></ColumnFamily>" + "</AccessGroup></Schema>"; Ns.CreateTable("test-5", Schema3); Assert.IsTrue(Ns.TableExists("test-5")); using (var table = Ns.OpenTable("test-5")) { Assert.AreEqual(3, table.GetTableSchema().AccessGroups.First().ColumnFamilies.First(cf => cf.Name == "b").Id); } Ns.CreateTable("1/2/3/test-5", Schema3, CreateDispositions.CreateIntermediate); Assert.IsTrue(Ns.NamespaceExists("1/2/3")); Assert.IsTrue(Ns.TableExists("1/2/3/test-5")); using (var table = Ns.OpenTable("1/2/3/test-5")) { Assert.AreEqual("test/1/2/3/test-5", table.Name); Assert.AreEqual(3, table.GetTableSchema().AccessGroups.First().ColumnFamilies.First(cf => cf.Name == "b").Id); } }