public void ExecutePagingDataTableBySelectSqlTest(int pageIndex, int pageSize, double discount) { const string selectSql = GetOrderDetailsSql + @" WHERE Discount > @Discount"; var parameters = new[] { new AdoParameter("Discount", discount) }; using ( new OperationTimer(string.Format("ExecutePagingDataTableBySqlString(pageIndex={0}, pageSize={1})", pageIndex, pageSize)) ) using (var pagingTable = NorthwindAdoRepository.ExecutePagingDataTableBySqlString(selectSql, pageIndex, pageSize, parameters) ) { Assert.AreEqual(pageIndex, pagingTable.PageIndex); Assert.AreEqual(pageSize, pagingTable.PageSize); Assert.IsTrue(pagingTable.TotalPageCount > 0); Assert.IsTrue(pagingTable.TotalItemCount > 0); Assert.IsTrue(pagingTable.Table.Rows.Count > 0); Assert.IsTrue(pagingTable.Table.Rows.Count <= pageSize); var table = pagingTable.Table; Assert.IsNotNull(table); Assert.IsFalse(table.HasErrors); Assert.IsTrue(table.Rows.Count > 0); } }
public void ExecutePagingDataTableBySelectSqlTest(string selectSql, int pageIndex, int pageSize) { using ( new OperationTimer(string.Format("ExecutePagingDataTableBySqlString(pageIndex=[{0}], pageSize=[{1}])", pageIndex, pageSize))) using (var pagingTable = NorthwindAdoRepository.ExecutePagingDataTableBySqlString(selectSql, pageIndex, pageSize)) { Assert.AreEqual(pageIndex, pagingTable.PageIndex); Assert.AreEqual(pageSize, pagingTable.PageSize); Assert.IsTrue(pagingTable.TotalPageCount > 0); Assert.IsTrue(pagingTable.TotalItemCount > 0); Assert.IsTrue(pagingTable.Table.Rows.Count > 0); Assert.IsTrue(pagingTable.Table.Rows.Count <= pageSize); var table = pagingTable.Table; Assert.IsNotNull(table); Assert.IsFalse(table.HasErrors); Assert.IsTrue(table.Rows.Count > 0); } }