Imported Upstream version 3.8.0

Former-commit-id: 6a76a29bd07d86e57c6c8da45c65ed5447d38a61
This commit is contained in:
Jo Shields
2014-09-04 09:07:35 +01:00
parent a575963da9
commit fe777c5c82
1062 changed files with 12460 additions and 5983 deletions

View File

@@ -542,6 +542,23 @@ namespace MonoTests.System.Data
Assert.AreEqual(sExpression,dc.Expression, "dce#2");
}
[Test]
public void Expression_Whitespace ()
{
DataColumn dc = new DataColumn ("ColName", typeof(string));
string plainWhitespace = " ";
string surroundWhitespace = " 'abc' ";
Assert.AreEqual (string.Empty, dc.Expression, "dce#1");
dc.Expression = plainWhitespace;
Assert.AreEqual (string.Empty, dc.Expression, "dce#2");
dc.Expression = surroundWhitespace;
Assert.AreEqual (surroundWhitespace, dc.Expression, "dce#3");
}
[Test]
public void Expression_Exceptions()
{

View File

@@ -2125,6 +2125,59 @@ namespace MonoTests.System.Data
#endregion
}
[Test]
public void IsNull_BeforeGetValue ()
{
DataTable table = new DataTable ();
// add the row, with the value in the column
DataColumn staticColumn = table.Columns.Add ("static", typeof(string), null); // static
DataRow row = table.Rows.Add ("the value");
Assert.IsFalse (row.IsNull ("static"), "static null check failed");
Assert.AreEqual ("the value", row ["static"], "static value check failed");
// add the first derived column
DataColumn firstColumn = table.Columns.Add ("first", typeof(string), "static"); // first -> static
Assert.IsFalse (row.IsNull ("first"), "first level null check failed");
Assert.AreEqual ("the value", row ["first"], "first level value check failed");
// add the second level of related
DataColumn secondColumn = table.Columns.Add ("second", typeof(string), "first"); // second -> first -> static
Assert.IsFalse (row.IsNull ("second"), "second level null check failed");
Assert.AreEqual ("the value", row ["second"], "second level value check failed");
}
[Test]
public void IsNull_NullValueArguments ()
{
DataTable table = new DataTable ();
// add the row, with the value in the column
DataColumn staticColumn = table.Columns.Add ("static", typeof(string), null);
DataRow row = table.Rows.Add ("the value");
try {
row.IsNull ((string)null);
Assert.Fail ("expected an arg null exception for passing a null string");
} catch (ArgumentNullException) {
// do nothing as null columns aren't allowed
}
try {
row.IsNull ("");
Assert.Fail ("expected an arg exception for passing an empty string");
} catch (ArgumentException) {
// do nothing as we can't find a col with no name
}
try {
row.IsNull (null, DataRowVersion.Default);
Assert.Fail ("null column with version check failed");
} catch (ArgumentNullException) {
// do nothing as null columns aren't allowed
}
}
[Test] public void Item()
{
// init table with columns