예제 #1
0
        public void should_get_data_table(
            [Values(FirstBatch, "")] string firstBatch)
        {
            var table = SqlStatement.ExecuteDataTable("fark", $"{firstBatch}SELECT * FROM {Database.FirstTable.Name}");

            table.TableName.ShouldEqual("fark");
            var rows = table.Rows.Cast <DataRow>().ToList();

            rows.Count.ShouldEqual(10);
            rows.All(x => ((string)x["Name"]).Length > 3).ShouldEqual(true);
            rows.All(x => (int)x["Id"] > -1).ShouldEqual(true);
            rows.First().ItemArray.Length.ShouldEqual(4);
            ((bool)rows.First()["hide"]).ShouldEqual(false);
            ((DateTime)rows.First()["timestamp"]).ShouldBeGreaterThan(DateTime.MinValue);
        }
예제 #2
0
 public static DataTable ExecuteDataTable(this ISqlStatement sqlStatement,
                                          string tableName, string commandText, object parameters)
 {
     return(sqlStatement.ExecuteDataTable(tableName, commandText, parameters.AsDictionary()));
 }