From: <gc...@us...> - 2003-05-30 15:16:48
|
Update of /cvsroot/dotnetmock/dotnetmock/DotNetMock.Framework/Data In directory sc8-pr-cvs1:/tmp/cvs-serv14423/DotNetMock.Framework/Data Added Files: MockDbDataAdapter.cs Log Message: --- NEW FILE: MockDbDataAdapter.cs --- using System; using System.Data; using System.Data.Common; using DotNetMock; namespace DotNetMock.Framework.Data { public class MockDbDataAdapter : DbDataAdapter, IMockObject { private ExpectationCounter _expectedFillCalls = new ExpectationCounter("MockDbDataAdapter.ExpectedFillCalls"); private DataSet _expectedDataSet = null; private string _name = ""; #region Public Constructors public MockDbDataAdapter() { this._name = "MockDbDataAdapter"; } public MockDbDataAdapter( IDbCommand selectCommand ) { } public MockDbDataAdapter( IDbCommand selectCommand, string selectConnectionString ) { } public MockDbDataAdapter( string selectCommandText, IDbConnection selectConnection ) { } #endregion #region Mock Methods public void SetExpectedFillCalls( int calls ) { _expectedFillCalls.Expected = calls; } public void SetExpectedDataSet( DataSet dataSet ) { _expectedDataSet = dataSet; } #endregion #region Implementation of IMockObject public void NotImplemented(string methodName) { throw new NotImplementedException( methodName + " is currently not implemented." ); } public string MockName { get { return _name; } set { _name = value; } } #endregion #region Implementation of IVerifiable public void Verify() { Verifier.Verify( this ); } #endregion #region Implementation of DbDataAdapter protected override System.Data.Common.RowUpdatedEventArgs CreateRowUpdatedEvent(System.Data.DataRow dataRow, System.Data.IDbCommand command, System.Data.StatementType statementType, System.Data.Common.DataTableMapping tableMapping) { return null; } protected override System.Data.Common.RowUpdatingEventArgs CreateRowUpdatingEvent(System.Data.DataRow dataRow, System.Data.IDbCommand command, System.Data.StatementType statementType, System.Data.Common.DataTableMapping tableMapping) { return null; } protected override void OnRowUpdated(System.Data.Common.RowUpdatedEventArgs value) { } protected override void OnRowUpdating(System.Data.Common.RowUpdatingEventArgs value) { } protected override int Fill(System.Data.DataTable dataTable, System.Data.IDataReader dataReader) { innerExecute(); return 0; } protected override int Fill(System.Data.DataSet dataSet, string srcTable, System.Data.IDataReader dataReader, int startRecord, int maxRecords) { innerExecute(); return 0; } protected override int Fill(System.Data.DataTable dataTable, System.Data.IDbCommand command, System.Data.CommandBehavior behavior) { innerExecute(); return 0; } protected override int Fill(System.Data.DataSet dataSet, int startRecord, int maxRecords, string srcTable, System.Data.IDbCommand command, System.Data.CommandBehavior behavior) { innerExecute(); return 0; } public override int Fill(System.Data.DataSet dataSet) { innerExecute(); return 0; } public new int Fill( System.Data.DataSet dataSet, string srcTable ) { innerExecute(); return 0; } public new int Fill( System.Data.DataSet dataSet, int startRecord, int maxRecords, string srcTable ) { innerExecute(); return 0; } public new int Fill( DataTable dataTable ) { innerExecute(); return 0; } #endregion private void innerExecute() { _expectedFillCalls.Inc(); } } } |