public void should_get_data_set( [Values(FirstBatch, "")] string firstBatch) { var tables = SqlStatement.ExecuteDataSet($"{firstBatch}SELECT * FROM {Database.FirstTable.Name}"); tables.Tables.Count.ShouldEqual(1); var table = tables.Tables.Cast <DataTable>().First(); table.TableName.ShouldEqual("Table"); 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); }
public static DataSet ExecuteDataSet(this ISqlStatement sqlStatement, string commandText, object parameters) { return(sqlStatement.ExecuteDataSet(commandText, parameters.AsDictionary())); }