diff options
author | Robert Wilkens <robwilkens@robwilkens-HP-Pavilion-g6-Notebook-PC.(none)> | 2012-05-26 03:27:46 +0400 |
---|---|---|
committer | Robert Wilkens <robwilkens@robwilkens-HP-Pavilion-g6-Notebook-PC.(none)> | 2012-05-26 03:27:46 +0400 |
commit | 410fbd4e879073bac22520616c44969c105d71d9 (patch) | |
tree | f9cb6c1b3c5e100b5cda070d0627e6cbf930d2c8 /mcs/class/System.Data | |
parent | 6cfebdcea70673e7274583c9837500914529745b (diff) |
This is the associated unit test for the Ximarin Bugzilla #853 bug...
Confirmed it fails without the bug fix, and passes with it.
Also confirmed again that no other System.Data tests failed that weren't
previously failing. With this test, there were 9 failures before the patch
is applied, and 8 failures after the patch is applied. Also tested before
I changed anything and previous to my changes 8 tests in System.Data were
already failing. This patch previosuly committed in other words does not
introduce any new bugs to the system.data tests.
Diffstat (limited to 'mcs/class/System.Data')
-rw-r--r-- | mcs/class/System.Data/Makefile | 2 | ||||
-rw-r--r-- | mcs/class/System.Data/SqliteTest.db | bin | 0 -> 3072 bytes | |||
-rw-r--r-- | mcs/class/System.Data/Test/System.Data.Common/DbDataAdapterTest.cs | 41 |
3 files changed, 42 insertions, 1 deletions
diff --git a/mcs/class/System.Data/Makefile b/mcs/class/System.Data/Makefile index 648db864b41..8b5e6d85120 100644 --- a/mcs/class/System.Data/Makefile +++ b/mcs/class/System.Data/Makefile @@ -44,7 +44,7 @@ LIB_MCS_FLAGS += \ endif endif -TEST_MCS_FLAGS = $(LIB_MCS_FLAGS) -r:System.Core.dll -nowarn:618,169,612,219,168 +TEST_MCS_FLAGS = $(LIB_MCS_FLAGS) -r:System.Core.dll -r:Mono.Data.Sqlite.dll -nowarn:618,169,612,219,168 TEST_MONO_PATH = . diff --git a/mcs/class/System.Data/SqliteTest.db b/mcs/class/System.Data/SqliteTest.db Binary files differnew file mode 100644 index 00000000000..afbf64b8bb4 --- /dev/null +++ b/mcs/class/System.Data/SqliteTest.db diff --git a/mcs/class/System.Data/Test/System.Data.Common/DbDataAdapterTest.cs b/mcs/class/System.Data/Test/System.Data.Common/DbDataAdapterTest.cs index b96de09c8f9..18e664a8d63 100644 --- a/mcs/class/System.Data/Test/System.Data.Common/DbDataAdapterTest.cs +++ b/mcs/class/System.Data/Test/System.Data.Common/DbDataAdapterTest.cs @@ -31,6 +31,10 @@ using System.Data; using System.Data.Common; using System.Data.SqlClient; +/*--For Bug 853 Test Begin--*/ +using Mono.Data.Sqlite; +/*--For Bug 853 Test End--*/ + using NUnit.Framework; namespace MonoTests.System.Data.Common @@ -180,6 +184,43 @@ namespace MonoTests.System.Data.Common Assert.IsNotNull (ex.Message, "#4"); } } + + [Test] + public void XimarinBugzillaBug853Test() + { + const string connectionString = "URI = file:./SqliteTest.db; Version = 3";//will be in System.Data directory + SqliteConnection dbConnection = new SqliteConnection(connectionString); + dbConnection.Open(); + SqliteCommand ClearTableEntry=new SqliteCommand("DELETE FROM Primus;",dbConnection); + ClearTableEntry.ExecuteNonQuery(); + + SqliteDataAdapter sqliteDataAdapter = new SqliteDataAdapter("SELECT * FROM primus", dbConnection); + SqliteCommandBuilder builder = new SqliteCommandBuilder(sqliteDataAdapter); + sqliteDataAdapter.InsertCommand = builder.GetInsertCommand(); + sqliteDataAdapter.DeleteCommand = builder.GetDeleteCommand(); + + DataSet dataSet = new DataSet(); + + sqliteDataAdapter.Fill(dataSet, "Primus");//reset + + DataRow rowToBeAdded = dataSet.Tables["Primus"].NewRow(); + rowToBeAdded["id"] = 123; + rowToBeAdded["name"] = "Name";//not null primary key + rowToBeAdded["value"] = 777; + + dataSet.Tables["Primus"].Rows.Add(rowToBeAdded); +sqliteDataAdapter.Update (dataSet, "Primus"); + + //This would fail with NULL constraint violation in bug + //report. Because before the patch, it would create + //a new record with all fields being null-- if the + //exception rises, test fails + sqliteDataAdapter.Update (dataSet, "Primus"); + + dbConnection.Close(); + dbConnection = null; + } + #endif class MyAdapter : DbDataAdapter |