Example #1
0
        public void should_get_data_set()
        {
            var tables = StoredProcedure.ExecuteDataSet("GetAll");

            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);
        }
Example #2
0
 public static DataSet ExecuteDataSet(this IStoredProcedure storedProcedure,
                                      string name, object parameters)
 {
     return(storedProcedure.ExecuteDataSet(name, parameters.AsDictionary()));
 }