public void NotNullOk() { var col = new DataColumn("stock_id", typeof(long)); col.AllowDBNull = false; TableSchema schema = new TableSchema("test1", col, new DataColumn("value", typeof(double))); DataTable t = schema.NewTempTable(); ScopedTable table = new ScopedTable(schema, t, null); DataRow row = table.NewRow(); row["stock_id"] = 1; row["value"] = 23.0d; table.Add(row); var rows = table.Rows.ToList(); Assert.AreEqual(1, rows.Count); Assert.AreEqual(1, row["stock_id"]); Assert.AreEqual(23.0d, row["value"]); }
private void AddStockPrice(ScopedTable table, string date, double value) { DataRow row = table.NewRow(); row["traded_stock_id"] = CurrentTradedStockId; row.SetDate(table.Schema, DateTime.Parse(date)); row["close"] = value; table.Add(row); }
protected void AddRow(ScopedTable table, long id, string value) { DataRow row = table.NewRow(); row[table.Schema.OwnerIdColumn] = id; row["Value"] = value; table.Add(row); }
protected void AddRow(ScopedTable table, long id, DateTime date, int value) { DataRow row = table.NewRow(); row[table.Schema.OwnerIdColumn] = id; row.SetDate(table.Schema, date); row["Value"] = value; table.Add(row); }
public void SetTimestamp() { TableSchema schema = new TableSchema("test1", new DataColumn("stock_id", typeof(long)), new DataColumn("timestamp", typeof(string)), new DataColumn("value", typeof(double))); DataTable t = schema.NewTempTable(); ScopedTable table = new ScopedTable(schema, t, null); DataRow row = table.NewRow(); row["stock_id"] = 1; row["value"] = 23.0d; table.Add(row); Assert.IsTrue(DateTime.Now.AlmostEquals(row.GetDate("timestamp"), 1)); }
public void NotNullIsNull() { var col = new DataColumn("stock_id", typeof(long)); col.AllowDBNull = false; TableSchema schema = new TableSchema("test1", col, new DataColumn("value", typeof(double))); DataTable t = schema.NewTempTable(); ScopedTable table = new ScopedTable(schema, t, null); DataRow row = table.NewRow(); row["value"] = 23.0d; table.Add(row); }