예제 #1
0
        protected override async Task <U2Pair> RunBatchingProxiedDbDataAdapterAsync(List <TestTable> randomDataSource, BatchingFakeProxiedDbDataAdapter adapter)
        {
            using (DbCommandBuilder <FakeDbCommand> cmdBuilder = await adapter.CreateCommandBuilderAsync().ConfigureAwait(false))
            {
                DataTable dataTable = new DataTable();

                // `.Fill` returns the number of rows in the first table, not any subsequent tables. Yes, that's silly.
                Int32 rowsInFirstTable = adapter.Fill(dataTable);
                rowsInFirstTable.ShouldBe(40);

                //
                Dictionary <String, Int32> rowsModified = DataTableMethods.MutateDataTable(dataTable);

                //
                adapter.UpdateCommand = cmdBuilder.GetUpdateCommand();
                adapter.UpdateCommand.NonQueryResultRowCountValue = (cmd) => DataTableMethods.GetUpdateStatementNonQueryResultRowCountValue(expectedTableName: "TODO", adapter, dataTable, cmd, rowsModified);

                DataRow[] rows = dataTable.Rows.Cast <DataRow>().ToArray();

                Int32 updatedRows = await adapter.Update2Async(rows);

//              updatedRows.ShouldBe( rowsModified );

                return(rows, rowsModified, updatedRows);
            }
        }
예제 #2
0
        protected override U3Pair RunProxiedDbDataAdapter(List <TestTable> randomDataSource, FakeProxiedDbDataAdapter adapter)
        {
            using (FakeDbCommandBuilder cmdBuilder = new FakeDbCommandBuilder(adapter))
            {
                DataTable dataTable = new DataTable();

                // `.Fill` returns the number of rows in the first table, not any subsequent tables. Yes, that's silly.
                Int32 rowsInFirstTable = adapter.Fill(dataTable);
                rowsInFirstTable.ShouldBe(40);

                //
                Dictionary <String, Int32> rowsModified = DataTableMethods.MutateDataTable(dataTable);

                //
                adapter.UpdateCommand = cmdBuilder.GetUpdateCommand();
                adapter.UpdateCommand.NonQueryResultRowCountValue = (cmd) => DataTableMethods.GetUpdateStatementNonQueryResultRowCountValue(expectedTableName: "TODO", adapter, dataTable, cmd, rowsModified);

                Int32 updatedRows = adapter.Update3(dataTable);
//              updatedRows.ShouldBe( rowsModified );

                return(dataTable, rowsModified, updatedRows);
            }
        }