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:
authorRoopa Wilson <roops@mono-cvs.ximian.com>2004-05-04 07:27:03 +0400
committerRoopa Wilson <roops@mono-cvs.ximian.com>2004-05-04 07:27:03 +0400
commitd3ad603cedf6d7a42c92e59f4e3e9c48214aef8e (patch)
tree30e7badb5eee02620fee5ad2b6e90b4c711e8f3f
parent8d739b4066860abfc0b11f904336552ae9756fcc (diff)
2004-05-04 Roopa Wilson (RoWilson@novell.com
* ForeignKeyConstraint.cs : Added code to handle InvalidOperationException * ForeignKeyConstraint.cs : Changed few exception types thrown * ForeignKeyConstraintTest.cs : Changed few exception types to be thrown svn path=/trunk/mcs/; revision=26680
-rw-r--r--mcs/class/System.Data/System.Data/ForeignKeyConstraint.cs10
-rw-r--r--mcs/class/System.Data/Test/System.Data/ForeignKeyConstraintTest.cs7
2 files changed, 8 insertions, 9 deletions
diff --git a/mcs/class/System.Data/System.Data/ForeignKeyConstraint.cs b/mcs/class/System.Data/System.Data/ForeignKeyConstraint.cs
index 21c9c9f3a3b..d747975c53c 100644
--- a/mcs/class/System.Data/System.Data/ForeignKeyConstraint.cs
+++ b/mcs/class/System.Data/System.Data/ForeignKeyConstraint.cs
@@ -38,7 +38,7 @@ namespace System.Data {
public ForeignKeyConstraint(DataColumn parentColumn, DataColumn childColumn)
{
if (null == parentColumn || null == childColumn) {
- throw new ArgumentNullException("Neither parentColumn or" +
+ throw new NullReferenceException("Neither parentColumn or" +
" childColumn can be null.");
}
_foreignKeyConstraint(null, new DataColumn[] {parentColumn},
@@ -53,7 +53,7 @@ namespace System.Data {
public ForeignKeyConstraint(string constraintName, DataColumn parentColumn, DataColumn childColumn)
{
if (null == parentColumn || null == childColumn) {
- throw new ArgumentNullException("Neither parentColumn or" +
+ throw new NullReferenceException("Neither parentColumn or" +
" childColumn can be null.");
}
@@ -211,7 +211,7 @@ namespace System.Data {
{
//LAMESPEC: spec says throw InvalidConstraintException
// implementation throws InvalidOperationException
- throw new ArgumentException("Parent column is not type compatible with it's child"
+ throw new InvalidConstraintException("Parent column is not type compatible with it's child"
+ " column.");
}
@@ -329,7 +329,7 @@ namespace System.Data {
if (_parentColumns.Length > 0)
return _parentColumns[0].Table;
- return null;
+ throw new InvalidOperationException ("Property not accessible because 'Object reference not set to an instance of an object'");
}
}
@@ -342,7 +342,7 @@ namespace System.Data {
if (_childColumns.Length > 0)
return _childColumns[0].Table;
- return null;
+ throw new InvalidOperationException ("Property not accessible because 'Object reference not set to an instance of an object'");
}
}
diff --git a/mcs/class/System.Data/Test/System.Data/ForeignKeyConstraintTest.cs b/mcs/class/System.Data/Test/System.Data/ForeignKeyConstraintTest.cs
index 81555980dfb..bbc36b2db0c 100644
--- a/mcs/class/System.Data/Test/System.Data/ForeignKeyConstraintTest.cs
+++ b/mcs/class/System.Data/Test/System.Data/ForeignKeyConstraintTest.cs
@@ -160,7 +160,6 @@ namespace MonoTests.System.Data
}
[Test]
- [Ignore ("table2.Constraints.AddRange (constraints) does not work.")]
public void TestCtor5()
{
DataTable table1 = new DataTable ("Table1");
@@ -209,7 +208,7 @@ namespace MonoTests.System.Data
}
catch(Exception e){
#if NET_1_1
- Assertion.AssertEquals ("#A03", typeof (InvalidOperationException), e.GetType());
+ Assertion.AssertEquals ("#A03", typeof (ArgumentException), e.GetType());
#else
Assertion.AssertEquals ("#A03", typeof (ArgumentException), e.GetType());
#endif
@@ -321,9 +320,9 @@ namespace MonoTests.System.Data
try
{
fkc = new ForeignKeyConstraint(_ds.Tables[0].Columns[0], localTable.Columns[1]);
- Fail("Failed to throw InvalidOperationException.");
+ Fail("Failed to throw InvalidConstraintException.");
}
- catch (InvalidOperationException) {}
+ catch (InvalidConstraintException) {}
catch (AssertionException exc) {throw exc;}
catch (Exception exc)
{