2 // DbDataAdapterTest.cs - NUnit Test Cases for testing the DbDataAdapter class
5 // Gert Driesen (drieseng@users.sourceforge.net)
7 // Copyright (c) 2007 Gert Driesen
9 // Permission is hereby granted, free of charge, to any person obtaining
10 // a copy of this software and associated documentation files (the
11 // "Software"), to deal in the Software without restriction, including
12 // without limitation the rights to use, copy, modify, merge, publish,
13 // distribute, sublicense, and/or sell copies of the Software, and to
14 // permit persons to whom the Software is furnished to do so, subject to
15 // the following conditions:
17 // The above copyright notice and this permission notice shall be
18 // included in all copies or substantial portions of the Software.
20 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
21 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
22 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
23 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
24 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
25 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
26 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
31 using System.Data.Common;
33 using NUnit.Framework;
35 namespace MonoTests.System.Data.Common
38 public class DbDataAdapterTest
42 public void UpdateBatchSize ()
44 MyAdapter da = new MyAdapter ();
46 da.UpdateBatchSize = 0;
48 } catch (NotSupportedException ex) {
49 // Specified method is not supported
50 Assert.AreEqual (typeof (NotSupportedException), ex.GetType (), "#A2");
51 Assert.IsNull (ex.InnerException, "#A3");
52 Assert.IsNotNull (ex.Message, "#A4");
54 Assert.AreEqual (1, da.UpdateBatchSize, "#A5");
57 da.UpdateBatchSize = int.MaxValue;
59 } catch (NotSupportedException ex) {
60 // Specified method is not supported
61 Assert.AreEqual (typeof (NotSupportedException), ex.GetType (), "#B2");
62 Assert.IsNull (ex.InnerException, "#B3");
63 Assert.IsNotNull (ex.Message, "#B4");
65 Assert.AreEqual (1, da.UpdateBatchSize, "#B5");
67 da.UpdateBatchSize = 1;
68 Assert.AreEqual (1, da.UpdateBatchSize, "#C");
72 public void UpdateBatchSize_Negative ()
74 MyAdapter da = new MyAdapter ();
76 da.UpdateBatchSize = -1;
78 } catch (NotSupportedException ex) {
79 // Specified method is not supported
80 Assert.AreEqual (typeof (NotSupportedException), ex.GetType (), "#2");
81 Assert.IsNull (ex.InnerException, "#3");
82 Assert.IsNotNull (ex.Message, "#4");
87 class MyAdapter : DbDataAdapter
90 protected override RowUpdatedEventArgs CreateRowUpdatedEvent (DataRow dataRow, IDbCommand command,
91 StatementType statementType,
92 DataTableMapping tableMapping)
94 throw new NotImplementedException ();
97 protected override RowUpdatingEventArgs CreateRowUpdatingEvent (DataRow dataRow, IDbCommand command,
98 StatementType statementType,
99 DataTableMapping tableMapping)
101 throw new NotImplementedException ();
104 protected override void OnRowUpdated (RowUpdatedEventArgs value)
106 throw new NotImplementedException ();
109 protected override void OnRowUpdating (RowUpdatingEventArgs value)
111 throw new NotImplementedException ();