public void TestTableCreate() { CrateDataReader reader = null; List <Table> schemadata = null; var tabledesc = (CrateTable)Attribute.GetCustomAttribute(typeof(CreatTestTable), typeof(CrateTable)); Assert.IsNotNull(tabledesc); TableUtils.DropTable(tabledesc.Name); using (var conn = TestCrateConnection()) { conn.Open(); conn.CreateTable <CreatTestTable>(); var sql = "SELECT * FROM information_schema.tables WHERE table_name= '" + tabledesc.Name + "'"; using (var cmd = new CrateCommand(sql, conn)) { reader = (CrateDataReader)cmd.ExecuteReader(); schemadata = reader.ToList <Table>(); } } Assert.IsNotNull(reader); Assert.IsNotNull(schemadata); Assert.Greater(schemadata.Count, 0); Assert.AreEqual(EnumHelpers.Replication(tabledesc.NumberOfReplicas), schemadata[0].NumberOfReplicas); Assert.AreEqual(tabledesc.NumberOfShards, schemadata[0].NumberOfShards); }
public void TestSelect() { using (var conn = TestCrateConnection()) { conn.Open(); using (var cmd = new CrateCommand("select name from sys.cluster", conn)) { var reader = cmd.ExecuteReader(); reader.Read(); string clusterName = reader.GetString(0); Assert.AreEqual(clusterName, "crate"); } } }