Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSenganal T <senga@mono-cvs.ximian.com>2006-02-11 14:08:14 +0300
committerSenganal T <senga@mono-cvs.ximian.com>2006-02-11 14:08:14 +0300
commitb3c23ed2150f499aa2cda370176a60a1f1cd794b (patch)
treec89149bb396578eb6416108bea555f386cd97789 /mcs/class/System.Data/Test
parent5f6b7974bfe61ba88067072f8046799fab8ef1c2 (diff)
Fixes for the failing testcases in System.Data .. Backporting r56531,r56336 ..
svn path=/branches/mono-1-1-13/mcs/; revision=56790
Diffstat (limited to 'mcs/class/System.Data/Test')
-rw-r--r--mcs/class/System.Data/Test/System.Data.SqlTypes/ChangeLog4
-rw-r--r--mcs/class/System.Data/Test/System.Data.SqlTypes/SqlStringTest.cs2
-rw-r--r--mcs/class/System.Data/Test/System.Data/ChangeLog9
-rw-r--r--mcs/class/System.Data/Test/System.Data/DataColumnCollectionTest.cs17
-rw-r--r--mcs/class/System.Data/Test/System.Data/DataColumnCollectionTest2.cs1
-rw-r--r--mcs/class/System.Data/Test/System.Data/DataColumnTest.cs13
-rw-r--r--mcs/class/System.Data/Test/System.Data/DataColumnTest2.cs5
-rw-r--r--mcs/class/System.Data/Test/System.Data/DataRowCollectionTest2.cs3
-rw-r--r--mcs/class/System.Data/Test/System.Data/DataRowViewTest.cs1
-rw-r--r--mcs/class/System.Data/Test/System.Data/DataTableCollectionTest2.cs9
-rw-r--r--mcs/class/System.Data/Test/System.Data/DataTableTest.cs63
-rw-r--r--mcs/class/System.Data/Test/System.Data/DataTableTest2.cs14
-rw-r--r--mcs/class/System.Data/Test/System.Data/DataViewTest.cs1
-rw-r--r--mcs/class/System.Data/Test/System.Data/EvaluateExceptionTest.cs1
14 files changed, 106 insertions, 37 deletions
diff --git a/mcs/class/System.Data/Test/System.Data.SqlTypes/ChangeLog b/mcs/class/System.Data/Test/System.Data.SqlTypes/ChangeLog
index 7346d089694..d8e0ab3873a 100644
--- a/mcs/class/System.Data/Test/System.Data.SqlTypes/ChangeLog
+++ b/mcs/class/System.Data/Test/System.Data.SqlTypes/ChangeLog
@@ -1,3 +1,7 @@
+2006-02-03 Senganal T <tsenganal@novell.com>
+
+ * SqlStringTest.cs : Removed NotWorking attribute for testcases fixed
+
2005-08-25 Sureshkumar T <tsureshkumar@novell.com>
* SqlDecimalTest.cs: use Assert rather than derive from Assertion.
diff --git a/mcs/class/System.Data/Test/System.Data.SqlTypes/SqlStringTest.cs b/mcs/class/System.Data/Test/System.Data.SqlTypes/SqlStringTest.cs
index 308ab647e88..6992d50be16 100644
--- a/mcs/class/System.Data/Test/System.Data.SqlTypes/SqlStringTest.cs
+++ b/mcs/class/System.Data/Test/System.Data.SqlTypes/SqlStringTest.cs
@@ -58,7 +58,6 @@ namespace MonoTests.System.Data.SqlTypes
// Test constructor
[Test]
- [Category ("NotWorking")]
public void Create()
{
@@ -182,7 +181,6 @@ namespace MonoTests.System.Data.SqlTypes
}
[Test]
- [Category ("NotWorking")]
public void CompareTo()
{
SqlByte Test = new SqlByte (1);
diff --git a/mcs/class/System.Data/Test/System.Data/ChangeLog b/mcs/class/System.Data/Test/System.Data/ChangeLog
index bd773316b4a..f4630c6af3f 100644
--- a/mcs/class/System.Data/Test/System.Data/ChangeLog
+++ b/mcs/class/System.Data/Test/System.Data/ChangeLog
@@ -1,3 +1,12 @@
+2006-02-03 Senganal T <tsenganal@novell.com>
+
+ * DataTableCollectionTest2.cs,EvaluateExceptionTest.cs,
+ DataColumnTest.cs,DataRowViewTest.cs,DataRowCollectionTest2.cs,
+ DataTableTest2.cs,DataTableTest.cs,DataColumnCollectionTest2.cs,
+ DataColumnCollectionTest.cs,DataViewTest.cs,DataColumnTest2.cs
+ - Removed 'NotWorking' attributes for the testcases fixed
+ - Added few new testcases
+
2006-01-17 Senganal T <tsenganal@novell.com>
* DataRowTest2.cs : added testcase for bug #77267
diff --git a/mcs/class/System.Data/Test/System.Data/DataColumnCollectionTest.cs b/mcs/class/System.Data/Test/System.Data/DataColumnCollectionTest.cs
index 6fde379b51b..e74ac86833a 100644
--- a/mcs/class/System.Data/Test/System.Data/DataColumnCollectionTest.cs
+++ b/mcs/class/System.Data/Test/System.Data/DataColumnCollectionTest.cs
@@ -390,12 +390,13 @@ namespace MonoTests.System.Data
}
[Test]
- [Category ("NotWorking")]
public void Clear_ExpressionColumn ()
{
DataTable table = new DataTable ("test");
table.Columns.Add ("col1", typeof(int));
table.Columns.Add ("col2", typeof (int), "sum(col1)");
+
+ //shudnt throw an exception.
table.Columns.Clear ();
AssertEquals ("#1", 0, table.Columns.Count);
}
@@ -555,6 +556,20 @@ namespace MonoTests.System.Data
}
[Test]
+ [ExpectedException (typeof (ArgumentException))]
+ public void Remove_Dep_Rel_Col ()
+ {
+ DataSet ds = new DataSet ();
+ ds.Tables.Add ("test");
+ ds.Tables.Add ("test1");
+ ds.Tables[0].Columns.Add ("col1", typeof(int));
+ ds.Tables[1].Columns.Add ("col2", typeof(int));
+
+ ds.Relations.Add ("rel1", ds.Tables[0].Columns[0], ds.Tables[1].Columns[0]);
+ ds.Tables[0].Columns.RemoveAt (0);
+ }
+
+ [Test]
public void ToStringTest ()
{
DataTable Table = new DataTable ("test_table");
diff --git a/mcs/class/System.Data/Test/System.Data/DataColumnCollectionTest2.cs b/mcs/class/System.Data/Test/System.Data/DataColumnCollectionTest2.cs
index 7f13c1a705e..5f6a1ea872f 100644
--- a/mcs/class/System.Data/Test/System.Data/DataColumnCollectionTest2.cs
+++ b/mcs/class/System.Data/Test/System.Data/DataColumnCollectionTest2.cs
@@ -332,7 +332,6 @@ namespace MonoTests.System.Data
}
[Test]
- [NUnit.Framework.Category ("NotWorking")]
public void TestIndexOf_ByColumnName()
{
DataTable dt = DataProvider.CreateParentDataTable();
diff --git a/mcs/class/System.Data/Test/System.Data/DataColumnTest.cs b/mcs/class/System.Data/Test/System.Data/DataColumnTest.cs
index 3a0652efc3d..2fdf1db3365 100644
--- a/mcs/class/System.Data/Test/System.Data/DataColumnTest.cs
+++ b/mcs/class/System.Data/Test/System.Data/DataColumnTest.cs
@@ -314,7 +314,6 @@ namespace MonoTests.System.Data
}
[Test]
- [Category ("NotWorking")]
public void ExpressionFunctions ()
{
DataTable T = new DataTable ("test");
@@ -365,9 +364,11 @@ namespace MonoTests.System.Data
C.Expression = "iff (age = 24, 'hurrey', 'boo')";
// The expression contains undefined function call iff().
- Fail ("DC34");
- } catch (EvaluateException) {}
- catch (SyntaxErrorException) {}
+ Fail ("DC34");
+ } catch (EvaluateException) {
+ } catch (SyntaxErrorException) {
+ }
+
//The following two cases fail on mono. MS.net evaluates the expression
//immediatly upon assignment. We don't do this yet hence we don't throw
@@ -376,8 +377,8 @@ namespace MonoTests.System.Data
C.Expression = "iif (nimi = 24, 'hurrey', 'boo')";
Fail ("DC36");
} catch (EvaluateException e) {
-// AssertEquals ("DC37", typeof (EvaluateException), e.GetType ());
-// AssertEquals ("DC38", "Cannot find column [nimi].", e.Message);
+ AssertEquals ("DC37", typeof (EvaluateException), e.GetType ());
+ AssertEquals ("DC38", "Cannot find column [nimi].", e.Message);
}
try {
diff --git a/mcs/class/System.Data/Test/System.Data/DataColumnTest2.cs b/mcs/class/System.Data/Test/System.Data/DataColumnTest2.cs
index c56db7ecd6c..76186b2a27b 100644
--- a/mcs/class/System.Data/Test/System.Data/DataColumnTest2.cs
+++ b/mcs/class/System.Data/Test/System.Data/DataColumnTest2.cs
@@ -505,9 +505,6 @@ namespace MonoTests.System.Data
}
[Test]
-#if !TARGET_JVM
- [Category ("NotWorking")]
-#endif
public void Expression_Exceptions()
{
DataTable dt = DataProvider.CreateParentDataTable();
@@ -581,7 +578,6 @@ namespace MonoTests.System.Data
}
-#if !KNOWN_BUG //BUG_NUM:3697
try
{
DataTable dt1 = DataProvider.CreateParentDataTable();
@@ -595,7 +591,6 @@ namespace MonoTests.System.Data
{
Assert.Fail("dccee#12: Expression. Wrong exception type. Got:" + exc);
}
-#endif
try
{
diff --git a/mcs/class/System.Data/Test/System.Data/DataRowCollectionTest2.cs b/mcs/class/System.Data/Test/System.Data/DataRowCollectionTest2.cs
index 67549b065a3..4e1d0d042b1 100644
--- a/mcs/class/System.Data/Test/System.Data/DataRowCollectionTest2.cs
+++ b/mcs/class/System.Data/Test/System.Data/DataRowCollectionTest2.cs
@@ -177,9 +177,6 @@ namespace MonoTests.System.Data
[Test]
[ExpectedException(typeof(NullReferenceException))]
-#if !TARGET_JVM
- [NUnit.Framework.Category ("NotWorking")]
-#endif
public void DataRowCollection_Add_O4()
{
DataTable dt = DataProvider.CreateParentDataTable();
diff --git a/mcs/class/System.Data/Test/System.Data/DataRowViewTest.cs b/mcs/class/System.Data/Test/System.Data/DataRowViewTest.cs
index 5493b797874..51885f37bcb 100644
--- a/mcs/class/System.Data/Test/System.Data/DataRowViewTest.cs
+++ b/mcs/class/System.Data/Test/System.Data/DataRowViewTest.cs
@@ -132,7 +132,6 @@ namespace MonoTests.System.Data
[Test]
[ExpectedException (typeof (RowNotInTableException))]
-// [NUnit.Framework.Category ("NotWorking")]
public void ItemException ()
{
DataTable dt = new DataTable ("table");
diff --git a/mcs/class/System.Data/Test/System.Data/DataTableCollectionTest2.cs b/mcs/class/System.Data/Test/System.Data/DataTableCollectionTest2.cs
index ec1db6f389c..408121d7aa6 100644
--- a/mcs/class/System.Data/Test/System.Data/DataTableCollectionTest2.cs
+++ b/mcs/class/System.Data/Test/System.Data/DataTableCollectionTest2.cs
@@ -308,9 +308,6 @@ namespace MonoTests_System.Data
[Test]
[ExpectedException(typeof(ArgumentException))]
-#if !TARGET_JVM
- [Category ("NotWorking")]
-#endif
public void DataTableCollection_Add_D3()
{
DataSet ds = new DataSet();
@@ -425,9 +422,6 @@ namespace MonoTests_System.Data
[Test]
[ExpectedException(typeof(ArgumentException))]
-#if !TARGET_JVM
- [Category ("NotWorking")]
-#endif
public void DataTableCollection_Remove_S2()
{
DataSet ds = new DataSet();
@@ -437,9 +431,6 @@ namespace MonoTests_System.Data
[Test]
[ExpectedException(typeof(ArgumentException))]
-#if !TARGET_JVM
- [Category ("NotWorking")]
-#endif
public void DataTableCollection_Remove_S3()
{
DataSet ds = new DataSet();
diff --git a/mcs/class/System.Data/Test/System.Data/DataTableTest.cs b/mcs/class/System.Data/Test/System.Data/DataTableTest.cs
index 4672c895157..aac0a0ba72c 100644
--- a/mcs/class/System.Data/Test/System.Data/DataTableTest.cs
+++ b/mcs/class/System.Data/Test/System.Data/DataTableTest.cs
@@ -1192,7 +1192,52 @@ namespace MonoTests.System.Data
row ["name"] = "Abc";
// keep silent as ms.net ;-), though this is not useful.
- table.ImportRow (row);
+ table.ImportRow (row);
+
+ //if RowState is detached, then dont import the row.
+ AssertEquals ("#1", 0, table.Rows.Count);
+ }
+
+ [Test]
+ [Category ("NotWorking")]
+ public void ImportRowDeletedTest ()
+ {
+ DataTable table = new DataTable ();
+ table.Columns.Add ("col", typeof (int));
+ table.Columns.Add ("col1", typeof (int));
+
+ DataRow row = table.Rows.Add (new object[] {1,2});
+ table.PrimaryKey = new DataColumn[] {table.Columns[0]};
+ table.AcceptChanges ();
+
+ // If row is in Deleted state, then ImportRow loads the
+ // row.
+ row.Delete ();
+ table.ImportRow (row);
+ AssertEquals ("#1", 2, table.Rows.Count);
+
+ // Both the deleted rows shud be now gone
+ table.AcceptChanges ();
+ AssertEquals ("#2", 0, table.Rows.Count);
+
+ //just add another row
+ row = table.Rows.Add (new object[] {1,2});
+ // no exception shud be thrown
+ table.AcceptChanges ();
+
+ // If row is in Deleted state, then ImportRow loads the
+ // row and validate only on RejectChanges
+ row.Delete ();
+ table.ImportRow (row);
+ AssertEquals ("#3", 2, table.Rows.Count);
+ AssertEquals ("#4", DataRowState.Deleted, table.Rows[1].RowState);
+
+ //FIXME : Currenty this fails.
+ try {
+ table.RejectChanges ();
+ Fail ("#5");
+ } catch (ConstraintException e) {
+ }
}
[Test]
@@ -1348,7 +1393,6 @@ namespace MonoTests.System.Data
[Test]
[ExpectedException (typeof (DataException))]
- [NUnit.Framework.Category ("NotWorking")]
public void SetPrimaryKeyAssertsNonNull ()
{
DataTable dt = new DataTable ("table");
@@ -1374,6 +1418,21 @@ namespace MonoTests.System.Data
dt.Rows.Add (new object [] {DBNull.Value, 3});
}
+ [Test]
+ public void PrimaryKey_CheckSetsAllowDBNull ()
+ {
+ DataTable table = new DataTable ();
+ DataColumn col1 = table.Columns.Add ("col1", typeof (int));
+ DataColumn col2 = table.Columns.Add ("col2", typeof (int));
+
+ AssertEquals ("#1" , true, col1.AllowDBNull);
+ AssertEquals ("#2" , true, col2.AllowDBNull);
+
+ table.PrimaryKey = new DataColumn[] {col1,col2};
+ AssertEquals ("#1" , false, col1.AllowDBNull);
+ AssertEquals ("#2" , false, col2.AllowDBNull);
+ }
+
void RowChanging (object o, DataRowChangeEventArgs e)
{
AssertEquals ("changing.Action", rowChangingExpectedAction, e.Action);
diff --git a/mcs/class/System.Data/Test/System.Data/DataTableTest2.cs b/mcs/class/System.Data/Test/System.Data/DataTableTest2.cs
index 73c5952a9b6..d5c83326c5a 100644
--- a/mcs/class/System.Data/Test/System.Data/DataTableTest2.cs
+++ b/mcs/class/System.Data/Test/System.Data/DataTableTest2.cs
@@ -1876,9 +1876,6 @@ namespace MonoTests_System.Data
}
[Test]
-#if !TARGET_JVM
- [Category ("NotWorking")]
-#endif
public void Select_StringString()
{
DataTable dt = DataProvider.CreateChildDataTable();
@@ -1984,8 +1981,15 @@ namespace MonoTests_System.Data
al.Sort(new DataRowsComparer("ChildId", "Asc"));
drSelect = dt.Select("ChildId * ParentId > 5 ","ChildId Asc");
- Assert.AreEqual(al.ToArray(),drSelect ,"DT199");
-
+ // Cannot check this way as ArrayList.Sort uses unstable sort and
+ // so the Order of the elements is not preserved when elements are equal
+ //Assert.AreEqual(al.ToArray(),drSelect ,"DT199");
+ Assert.AreEqual (al.Count, drSelect.Length, "#DT199");
+ for (int i=0; i<al.Count; ++i){
+ // check the datarow is present and that the sort order is correct
+ Assert.IsTrue (Array.IndexOf (drSelect, al[i]) != -1, "#DT_199_2_"+i);
+ Assert.AreEqual ( ((DataRow)al[i])["ChildId"], drSelect[i]["ChildId"], "#DT_199_1" +i);
+ }
//get excepted resault
al = new System.Collections.ArrayList();
diff --git a/mcs/class/System.Data/Test/System.Data/DataViewTest.cs b/mcs/class/System.Data/Test/System.Data/DataViewTest.cs
index e56531118cd..f7d4e83d09c 100644
--- a/mcs/class/System.Data/Test/System.Data/DataViewTest.cs
+++ b/mcs/class/System.Data/Test/System.Data/DataViewTest.cs
@@ -593,7 +593,6 @@ namespace MonoTests.System.Data
}
[Test]
- [NUnit.Framework.Category ("NotWorking")]
public void CancelEditAndEvents ()
{
string reference = " =====ItemAdded:3 ------4 =====ItemAdded:3 =====ItemAdded:4 ------5 =====ItemAdded:4 =====ItemAdded:5 ------6 =====ItemDeleted:5 ------5 =====ItemAdded:5";
diff --git a/mcs/class/System.Data/Test/System.Data/EvaluateExceptionTest.cs b/mcs/class/System.Data/Test/System.Data/EvaluateExceptionTest.cs
index 25869d70f8d..dd6fe52c914 100644
--- a/mcs/class/System.Data/Test/System.Data/EvaluateExceptionTest.cs
+++ b/mcs/class/System.Data/Test/System.Data/EvaluateExceptionTest.cs
@@ -38,7 +38,6 @@ namespace MonoTests_System.Data
[TestFixture] public class EvaluateExceptionTest
{
[Test]
- [Category("NotWorking")]
public void Generate()
{
Exception tmpEx = new Exception() ;