Imported Upstream version 4.8.0.309

Former-commit-id: 5f9c6ae75f295e057a7d2971f3a6df4656fa8850
This commit is contained in:
Xamarin Public Jenkins (auto-signing)
2016-11-10 13:04:39 +00:00
parent ee1447783b
commit 94b2861243
4912 changed files with 390737 additions and 49310 deletions

View File

@@ -96,10 +96,14 @@ namespace MonoTests.System.Data.Common
try {
da.AddToBatch (new SqlCommand ());
Assert.Fail ("#1");
#if FEATURE_NO_BSD_SOCKETS
} catch (PlatformNotSupportedException) {
#else
} catch (NotSupportedException ex) {
Assert.AreEqual (typeof (NotSupportedException), ex.GetType (), "#2");
Assert.IsNull (ex.InnerException, "#3");
Assert.IsNotNull (ex.Message, "#4");
#endif
}
}

View File

@@ -61,7 +61,6 @@ namespace MonoTests.System.Data.Common
{
}
#if NET_4_5
[Test]
public void GetFieldValueTest ()
{
@@ -155,7 +154,6 @@ namespace MonoTests.System.Data.Common
Assert.IsFalse (dataReader.Read (), "#5");
}
#endif //NET_4_5
}
}

View File

@@ -39,21 +39,33 @@ namespace MonoTests.System.Data.SqlClient {
private const string testFailParamNameMessage = "We have to provide the same parameter name as in original .NET";
[Test] // .ctor(SqlConnection connection)
#if FEATURE_NO_BSD_SOCKETS
[ExpectedException (typeof (PlatformNotSupportedException))]
#else
[ExpectedException (typeof(ArgumentNullException))]
#endif
public void ConstructorNotNull1 ()
{
new SqlBulkCopy ((SqlConnection)null);
}
[Test] // .ctor(string connectionString)
#if FEATURE_NO_BSD_SOCKETS
[ExpectedException (typeof (PlatformNotSupportedException))]
#else
[ExpectedException (typeof(ArgumentNullException))]
#endif
public void ConstructorNotNull2 ()
{
new SqlBulkCopy ((string)null);
}
[Test] // .ctor(SqlConnection connection)
#if FEATURE_NO_BSD_SOCKETS
[ExpectedException (typeof (PlatformNotSupportedException))]
#else
[ExpectedException (typeof(ArgumentNullException))]
#endif
public void ConstructorNotNull3 ()
{
try {
@@ -65,7 +77,11 @@ namespace MonoTests.System.Data.SqlClient {
}
[Test] // .ctor(string connectionString)
#if FEATURE_NO_BSD_SOCKETS
[ExpectedException (typeof (PlatformNotSupportedException))]
#else
[ExpectedException (typeof(ArgumentNullException))]
#endif
public void ConstructorNotNull4 ()
{
try {
@@ -77,7 +93,11 @@ namespace MonoTests.System.Data.SqlClient {
}
[Test] // .ctor(string connectionString)
#if FEATURE_NO_BSD_SOCKETS
[ExpectedException (typeof (PlatformNotSupportedException))]
#else
[ExpectedException (typeof(ArgumentNullException))]
#endif
public void ConstructorNotNull5 ()
{
try {
@@ -89,7 +109,11 @@ namespace MonoTests.System.Data.SqlClient {
}
[Test] // .ctor(string connectionString)
#if FEATURE_NO_BSD_SOCKETS
[ExpectedException (typeof (PlatformNotSupportedException))]
#else
[ExpectedException (typeof(ArgumentNullException))]
#endif
public void ConstructorNotNull6 ()
{
try {

View File

@@ -38,6 +38,9 @@ namespace MonoTests.System.Data.Odbc
public class SqlCommandBuilderTest
{
[Test]
#if FEATURE_NO_BSD_SOCKETS
[ExpectedException (typeof (PlatformNotSupportedException))]
#endif
public void CatalogLocationTest ()
{
SqlCommandBuilder cb = new SqlCommandBuilder ();
@@ -47,6 +50,9 @@ namespace MonoTests.System.Data.Odbc
}
[Test]
#if FEATURE_NO_BSD_SOCKETS
[ExpectedException (typeof (PlatformNotSupportedException))]
#endif
public void CatalogLocation_Value_Invalid ()
{
SqlCommandBuilder cb = new SqlCommandBuilder ();
@@ -82,6 +88,9 @@ namespace MonoTests.System.Data.Odbc
}
[Test]
#if FEATURE_NO_BSD_SOCKETS
[ExpectedException (typeof (PlatformNotSupportedException))]
#endif
public void CatalogSeparator ()
{
SqlCommandBuilder cb = new SqlCommandBuilder ();
@@ -89,6 +98,9 @@ namespace MonoTests.System.Data.Odbc
}
[Test]
#if FEATURE_NO_BSD_SOCKETS
[ExpectedException (typeof (PlatformNotSupportedException))]
#endif
public void CatalogSeparator_Value_Invalid ()
{
string [] separators = new string [] {
@@ -118,6 +130,9 @@ namespace MonoTests.System.Data.Odbc
}
[Test]
#if FEATURE_NO_BSD_SOCKETS
[ExpectedException (typeof (PlatformNotSupportedException))]
#endif
public void ConflictOptionTest ()
{
SqlCommandBuilder cb = new SqlCommandBuilder ();
@@ -127,6 +142,9 @@ namespace MonoTests.System.Data.Odbc
}
[Test]
#if FEATURE_NO_BSD_SOCKETS
[ExpectedException (typeof (PlatformNotSupportedException))]
#endif
public void ConflictOption_Value_Invalid ()
{
SqlCommandBuilder cb = new SqlCommandBuilder ();
@@ -147,6 +165,9 @@ namespace MonoTests.System.Data.Odbc
}
[Test] // QuoteIdentifier (String)
#if FEATURE_NO_BSD_SOCKETS
[ExpectedException (typeof (PlatformNotSupportedException))]
#endif
public void QuoteIdentifier ()
{
SqlCommandBuilder cb;
@@ -173,6 +194,9 @@ namespace MonoTests.System.Data.Odbc
}
[Test]
#if FEATURE_NO_BSD_SOCKETS
[ExpectedException (typeof (PlatformNotSupportedException))]
#endif
public void QuoteIdentifier_PrefixSuffix_NoMatch ()
{
SqlCommandBuilder cb;
@@ -211,6 +235,9 @@ namespace MonoTests.System.Data.Odbc
}
[Test] // QuoteIdentifier (String)
#if FEATURE_NO_BSD_SOCKETS
[ExpectedException (typeof (PlatformNotSupportedException))]
#endif
public void QuoteIdentifier_UnquotedIdentifier_Null ()
{
SqlCommandBuilder cb = new SqlCommandBuilder ();
@@ -226,6 +253,9 @@ namespace MonoTests.System.Data.Odbc
}
[Test]
#if FEATURE_NO_BSD_SOCKETS
[ExpectedException (typeof (PlatformNotSupportedException))]
#endif
public void QuotePrefix ()
{
SqlCommandBuilder cb = new SqlCommandBuilder ();
@@ -240,6 +270,9 @@ namespace MonoTests.System.Data.Odbc
}
[Test]
#if FEATURE_NO_BSD_SOCKETS
[ExpectedException (typeof (PlatformNotSupportedException))]
#endif
public void QuotePrefix_Value_Invalid ()
{
string [] prefixes = new string [] {
@@ -268,6 +301,9 @@ namespace MonoTests.System.Data.Odbc
}
[Test]
#if FEATURE_NO_BSD_SOCKETS
[ExpectedException (typeof (PlatformNotSupportedException))]
#endif
public void QuoteSuffix ()
{
SqlCommandBuilder cb = new SqlCommandBuilder ();
@@ -282,6 +318,9 @@ namespace MonoTests.System.Data.Odbc
}
[Test]
#if FEATURE_NO_BSD_SOCKETS
[ExpectedException (typeof (PlatformNotSupportedException))]
#endif
public void QuoteSuffix_Value_Invalid ()
{
string [] suffixes = new string [] {
@@ -310,6 +349,9 @@ namespace MonoTests.System.Data.Odbc
}
[Test]
#if FEATURE_NO_BSD_SOCKETS
[ExpectedException (typeof (PlatformNotSupportedException))]
#endif
public void SchemaSeparator ()
{
SqlCommandBuilder cb = new SqlCommandBuilder ();
@@ -319,6 +361,9 @@ namespace MonoTests.System.Data.Odbc
}
[Test]
#if FEATURE_NO_BSD_SOCKETS
[ExpectedException (typeof (PlatformNotSupportedException))]
#endif
public void SchemaSeparator_Value_Invalid ()
{
string [] separators = new string [] {

View File

@@ -42,6 +42,9 @@ namespace MonoTests.System.Data.SqlClient
const string COMMAND_TEXT = "SELECT * FROM Authors";
[Test] // SqlCommand ()
#if FEATURE_NO_BSD_SOCKETS
[ExpectedException (typeof (PlatformNotSupportedException))]
#endif
public void Constructor1 ()
{
SqlCommand cmd = new SqlCommand ();
@@ -61,6 +64,9 @@ namespace MonoTests.System.Data.SqlClient
}
[Test] // SqlCommand (string)
#if FEATURE_NO_BSD_SOCKETS
[ExpectedException (typeof (PlatformNotSupportedException))]
#endif
public void Constructor2 ()
{
SqlCommand cmd = new SqlCommand (COMMAND_TEXT);
@@ -95,6 +101,9 @@ namespace MonoTests.System.Data.SqlClient
}
[Test] // SqlCommand (string, SqlConnection)
#if FEATURE_NO_BSD_SOCKETS
[ExpectedException (typeof (PlatformNotSupportedException))]
#endif
public void Constructor3 ()
{
SqlConnection conn = new SqlConnection ();
@@ -147,6 +156,9 @@ namespace MonoTests.System.Data.SqlClient
}
[Test] // SqlCommand (string, SqlConnection, SqlTransaction)
#if FEATURE_NO_BSD_SOCKETS
[ExpectedException (typeof (PlatformNotSupportedException))]
#endif
public void Constructor4 ()
{
SqlConnection conn = new SqlConnection ();
@@ -199,6 +211,9 @@ namespace MonoTests.System.Data.SqlClient
}
[Test]
#if FEATURE_NO_BSD_SOCKETS
[ExpectedException (typeof (PlatformNotSupportedException))]
#endif
public void Clone ()
{
SqlNotificationRequest notificationReq = new SqlNotificationRequest ();
@@ -237,6 +252,9 @@ namespace MonoTests.System.Data.SqlClient
}
[Test]
#if FEATURE_NO_BSD_SOCKETS
[ExpectedException (typeof (PlatformNotSupportedException))]
#endif
public void CommandText ()
{
SqlCommand cmd = new SqlCommand ();
@@ -251,6 +269,9 @@ namespace MonoTests.System.Data.SqlClient
}
[Test]
#if FEATURE_NO_BSD_SOCKETS
[ExpectedException (typeof (PlatformNotSupportedException))]
#endif
public void CommandTimeout ()
{
SqlCommand cmd = new SqlCommand ();
@@ -263,6 +284,9 @@ namespace MonoTests.System.Data.SqlClient
}
[Test]
#if FEATURE_NO_BSD_SOCKETS
[ExpectedException (typeof (PlatformNotSupportedException))]
#endif
public void CommandTimeout_Value_Negative ()
{
SqlCommand cmd = new SqlCommand ();
@@ -279,6 +303,9 @@ namespace MonoTests.System.Data.SqlClient
}
[Test]
#if FEATURE_NO_BSD_SOCKETS
[ExpectedException (typeof (PlatformNotSupportedException))]
#endif
public void CommandType_Value_Invalid ()
{
SqlCommand cmd = new SqlCommand ();
@@ -296,6 +323,9 @@ namespace MonoTests.System.Data.SqlClient
}
[Test] // bug #324386
#if FEATURE_NO_BSD_SOCKETS
[ExpectedException (typeof (PlatformNotSupportedException))]
#endif
public void Dispose ()
{
string connectionString = "Initial Catalog=a;Server=b;User ID=c;"
@@ -307,6 +337,9 @@ namespace MonoTests.System.Data.SqlClient
}
[Test]
#if FEATURE_NO_BSD_SOCKETS
[ExpectedException (typeof (PlatformNotSupportedException))]
#endif
public void ExecuteNonQuery_Connection_Closed ()
{
string connectionString = "Initial Catalog=a;Server=b;User ID=c;"
@@ -329,6 +362,9 @@ namespace MonoTests.System.Data.SqlClient
}
[Test]
#if FEATURE_NO_BSD_SOCKETS
[ExpectedException (typeof (PlatformNotSupportedException))]
#endif
public void ExecuteNonQuery_Connection_Null ()
{
SqlCommand cmd = new SqlCommand ("delete from whatever");
@@ -346,6 +382,9 @@ namespace MonoTests.System.Data.SqlClient
}
[Test]
#if FEATURE_NO_BSD_SOCKETS
[ExpectedException (typeof (PlatformNotSupportedException))]
#endif
public void ExecuteReader_Connection_Closed ()
{
string connectionString = "Initial Catalog=a;Server=b;User ID=c;"
@@ -368,6 +407,9 @@ namespace MonoTests.System.Data.SqlClient
}
[Test]
#if FEATURE_NO_BSD_SOCKETS
[ExpectedException (typeof (PlatformNotSupportedException))]
#endif
public void ExecuteReader_Connection_Null ()
{
SqlCommand cmd = new SqlCommand ("select * from whatever");
@@ -385,6 +427,9 @@ namespace MonoTests.System.Data.SqlClient
}
[Test]
#if FEATURE_NO_BSD_SOCKETS
[ExpectedException (typeof (PlatformNotSupportedException))]
#endif
public void ExecuteScalar_Connection_Closed ()
{
string connectionString = "Initial Catalog=a;Server=b;User ID=c;"
@@ -407,6 +452,9 @@ namespace MonoTests.System.Data.SqlClient
}
[Test] // bug #412584
#if FEATURE_NO_BSD_SOCKETS
[ExpectedException (typeof (PlatformNotSupportedException))]
#endif
public void ExecuteScalar_Connection_Null ()
{
SqlCommand cmd = new SqlCommand ("select count(*) from whatever");
@@ -425,6 +473,9 @@ namespace MonoTests.System.Data.SqlClient
// FIXME: this actually doesn't match .NET behavior. It shouldn't throw NRE.
[Test]
#if FEATURE_NO_BSD_SOCKETS
[ExpectedException (typeof (PlatformNotSupportedException))]
#endif
public void Prepare_Connection_Null ()
{
SqlCommand cmd;
@@ -477,6 +528,9 @@ namespace MonoTests.System.Data.SqlClient
}
[Test] // bug #412586
#if FEATURE_NO_BSD_SOCKETS
[ExpectedException (typeof (PlatformNotSupportedException))]
#endif
public void Prepare_Connection_Closed ()
{
string connectionString = "Initial Catalog=a;Server=b;User ID=c;"
@@ -527,6 +581,9 @@ namespace MonoTests.System.Data.SqlClient
}
[Test]
#if FEATURE_NO_BSD_SOCKETS
[ExpectedException (typeof (PlatformNotSupportedException))]
#endif
public void ResetCommandTimeout ()
{
SqlCommand cmd = new SqlCommand ();
@@ -537,6 +594,9 @@ namespace MonoTests.System.Data.SqlClient
}
[Test]
#if FEATURE_NO_BSD_SOCKETS
[ExpectedException (typeof (PlatformNotSupportedException))]
#endif
public void UpdatedRowSource ()
{
SqlCommand cmd = new SqlCommand ();
@@ -547,6 +607,9 @@ namespace MonoTests.System.Data.SqlClient
}
[Test]
#if FEATURE_NO_BSD_SOCKETS
[ExpectedException (typeof (PlatformNotSupportedException))]
#endif
public void UpdatedRowSource_Value_Invalid ()
{
SqlCommand cmd = new SqlCommand ();
@@ -565,6 +628,9 @@ namespace MonoTests.System.Data.SqlClient
[Test] // bug #381100
#if FEATURE_NO_BSD_SOCKETS
[ExpectedException (typeof (PlatformNotSupportedException))]
#endif
public void ParameterCollectionTest ()
{
SqlCommand cmd = new SqlCommand();

View File

@@ -39,6 +39,9 @@ namespace MonoTests.System.Data.SqlClient
public class SqlConnectionTest
{
[Test] // SqlConnection ()
#if FEATURE_NO_BSD_SOCKETS
[ExpectedException (typeof (PlatformNotSupportedException))]
#endif
public void Constructor1 ()
{
SqlConnection cn = new SqlConnection ();
@@ -57,6 +60,9 @@ namespace MonoTests.System.Data.SqlClient
}
[Test] // SqlConnection (string)
#if FEATURE_NO_BSD_SOCKETS
[ExpectedException (typeof (PlatformNotSupportedException))]
#endif
public void Constructor2 ()
{
string connectionString = "server=SQLSRV; database=Mono;";
@@ -89,6 +95,9 @@ namespace MonoTests.System.Data.SqlClient
}
[Test]
#if FEATURE_NO_BSD_SOCKETS
[ExpectedException (typeof (PlatformNotSupportedException))]
#endif
public void Constructor2_ConnectionString_Invalid ()
{
try {
@@ -181,6 +190,9 @@ namespace MonoTests.System.Data.SqlClient
}
[Test]
#if FEATURE_NO_BSD_SOCKETS
[ExpectedException (typeof (PlatformNotSupportedException))]
#endif
public void BeginTransaction_Connection_Closed ()
{
SqlConnection cn = new SqlConnection ();
@@ -247,6 +259,9 @@ namespace MonoTests.System.Data.SqlClient
}
[Test]
#if FEATURE_NO_BSD_SOCKETS
[ExpectedException (typeof (PlatformNotSupportedException))]
#endif
public void ChangeDatabase_Connection_Closed ()
{
SqlConnection cn = new SqlConnection ();
@@ -264,6 +279,9 @@ namespace MonoTests.System.Data.SqlClient
}
[Test]
#if FEATURE_NO_BSD_SOCKETS
[ExpectedException (typeof (PlatformNotSupportedException))]
#endif
public void ChangePassword_ConnectionString_Empty ()
{
try {
@@ -279,6 +297,9 @@ namespace MonoTests.System.Data.SqlClient
}
[Test]
#if FEATURE_NO_BSD_SOCKETS
[ExpectedException (typeof (PlatformNotSupportedException))]
#endif
public void ChangePassword_ConnectionString_Null ()
{
try {
@@ -293,7 +314,10 @@ namespace MonoTests.System.Data.SqlClient
}
}
[Test]
#if FEATURE_NO_BSD_SOCKETS
[ExpectedException (typeof (PlatformNotSupportedException))]
#endif
public void ChangePassword_NewPassword_Empty ()
{
try {
@@ -309,6 +333,9 @@ namespace MonoTests.System.Data.SqlClient
}
[Test]
#if FEATURE_NO_BSD_SOCKETS
[ExpectedException (typeof (PlatformNotSupportedException))]
#endif
public void ChangePassword_NewPassword_ExceedMaxLength ()
{
try {
@@ -328,6 +355,9 @@ namespace MonoTests.System.Data.SqlClient
}
[Test]
#if FEATURE_NO_BSD_SOCKETS
[ExpectedException (typeof (PlatformNotSupportedException))]
#endif
public void ChangePassword_NewPassword_Null ()
{
try {
@@ -343,6 +373,9 @@ namespace MonoTests.System.Data.SqlClient
}
[Test]
#if FEATURE_NO_BSD_SOCKETS
[ExpectedException (typeof (PlatformNotSupportedException))]
#endif
public void ClearPool_Connection_Null ()
{
try {
@@ -357,6 +390,9 @@ namespace MonoTests.System.Data.SqlClient
}
[Test]
#if FEATURE_NO_BSD_SOCKETS
[ExpectedException (typeof (PlatformNotSupportedException))]
#endif
public void ConnectionString ()
{
SqlConnection cn = new SqlConnection ();
@@ -371,6 +407,9 @@ namespace MonoTests.System.Data.SqlClient
}
[Test]
#if FEATURE_NO_BSD_SOCKETS
[ExpectedException (typeof (PlatformNotSupportedException))]
#endif
public void ConnectionString_Value_Invalid ()
{
SqlConnection cn = new SqlConnection ();
@@ -403,6 +442,9 @@ namespace MonoTests.System.Data.SqlClient
}
[Test]
#if FEATURE_NO_BSD_SOCKETS
[ExpectedException (typeof (PlatformNotSupportedException))]
#endif
public void CreateCommand ()
{
SqlConnection cn = new SqlConnection ();
@@ -424,6 +466,9 @@ namespace MonoTests.System.Data.SqlClient
}
[Test]
#if FEATURE_NO_BSD_SOCKETS
[ExpectedException (typeof (PlatformNotSupportedException))]
#endif
public void Dispose ()
{
SqlConnection cn = new SqlConnection ("Server=SQLSRV;Database=master;Timeout=25;Packet Size=512;Workstation ID=DUMMY");
@@ -443,6 +488,9 @@ namespace MonoTests.System.Data.SqlClient
}
[Test]
#if FEATURE_NO_BSD_SOCKETS
[ExpectedException (typeof (PlatformNotSupportedException))]
#endif
public void GetSchema_Connection_Closed ()
{
SqlConnection cn = new SqlConnection ();
@@ -519,6 +567,9 @@ namespace MonoTests.System.Data.SqlClient
}
[Test]
#if FEATURE_NO_BSD_SOCKETS
[ExpectedException (typeof (PlatformNotSupportedException))]
#endif
public void ConnectionString_AsynchronousProcessing ()
{
SqlConnection cn = new SqlConnection ();
@@ -527,6 +578,9 @@ namespace MonoTests.System.Data.SqlClient
}
[Test]
#if FEATURE_NO_BSD_SOCKETS
[ExpectedException (typeof (PlatformNotSupportedException))]
#endif
public void ConnectionString_ConnectTimeout ()
{
SqlConnection cn = new SqlConnection ();
@@ -543,6 +597,9 @@ namespace MonoTests.System.Data.SqlClient
}
[Test]
#if FEATURE_NO_BSD_SOCKETS
[ExpectedException (typeof (PlatformNotSupportedException))]
#endif
public void ConnectionString_ConnectTimeout_Invalid ()
{
SqlConnection cn = new SqlConnection ();
@@ -600,6 +657,9 @@ namespace MonoTests.System.Data.SqlClient
}
[Test]
#if FEATURE_NO_BSD_SOCKETS
[ExpectedException (typeof (PlatformNotSupportedException))]
#endif
public void ConnectionString_Database_Synonyms ()
{
SqlConnection cn = null;
@@ -614,6 +674,9 @@ namespace MonoTests.System.Data.SqlClient
}
[Test]
#if FEATURE_NO_BSD_SOCKETS
[ExpectedException (typeof (PlatformNotSupportedException))]
#endif
public void ConnectionString_DataSource_Synonyms ()
{
SqlConnection cn = null;
@@ -640,6 +703,9 @@ namespace MonoTests.System.Data.SqlClient
}
[Test]
#if FEATURE_NO_BSD_SOCKETS
[ExpectedException (typeof (PlatformNotSupportedException))]
#endif
public void ConnectionString_MaxPoolSize ()
{
SqlConnection cn = new SqlConnection ();
@@ -649,6 +715,9 @@ namespace MonoTests.System.Data.SqlClient
}
[Test]
#if FEATURE_NO_BSD_SOCKETS
[ExpectedException (typeof (PlatformNotSupportedException))]
#endif
public void ConnectionString_MaxPoolSize_Invalid ()
{
SqlConnection cn = new SqlConnection ();
@@ -733,6 +802,9 @@ namespace MonoTests.System.Data.SqlClient
}
[Test]
#if FEATURE_NO_BSD_SOCKETS
[ExpectedException (typeof (PlatformNotSupportedException))]
#endif
public void ConnectionString_MinPoolSize ()
{
SqlConnection cn = new SqlConnection ();
@@ -742,6 +814,9 @@ namespace MonoTests.System.Data.SqlClient
}
[Test]
#if FEATURE_NO_BSD_SOCKETS
[ExpectedException (typeof (PlatformNotSupportedException))]
#endif
public void ConnectionString_MinPoolSize_Invalid ()
{
SqlConnection cn = new SqlConnection ();
@@ -799,6 +874,9 @@ namespace MonoTests.System.Data.SqlClient
}
[Test]
#if FEATURE_NO_BSD_SOCKETS
[ExpectedException (typeof (PlatformNotSupportedException))]
#endif
public void ConnectionString_MultipleActiveResultSets ()
{
SqlConnection cn = new SqlConnection ();
@@ -806,6 +884,9 @@ namespace MonoTests.System.Data.SqlClient
}
[Test]
#if FEATURE_NO_BSD_SOCKETS
[ExpectedException (typeof (PlatformNotSupportedException))]
#endif
public void ConnectionString_MultipleActiveResultSets_Invalid ()
{
SqlConnection cn = new SqlConnection ();
@@ -823,6 +904,9 @@ namespace MonoTests.System.Data.SqlClient
}
[Test]
#if FEATURE_NO_BSD_SOCKETS
[ExpectedException (typeof (PlatformNotSupportedException))]
#endif
public void ConnectionString_NetworkLibrary_Synonyms ()
{
SqlConnection cn = new SqlConnection ();
@@ -832,6 +916,9 @@ namespace MonoTests.System.Data.SqlClient
}
[Test]
#if FEATURE_NO_BSD_SOCKETS
[ExpectedException (typeof (PlatformNotSupportedException))]
#endif
public void ConnectionString_PacketSize ()
{
SqlConnection cn = new SqlConnection ();
@@ -848,6 +935,9 @@ namespace MonoTests.System.Data.SqlClient
}
[Test]
#if FEATURE_NO_BSD_SOCKETS
[ExpectedException (typeof (PlatformNotSupportedException))]
#endif
public void ConnectionString_PacketSize_Invalid ()
{
SqlConnection cn = new SqlConnection ();
@@ -901,6 +991,9 @@ namespace MonoTests.System.Data.SqlClient
}
[Test]
#if FEATURE_NO_BSD_SOCKETS
[ExpectedException (typeof (PlatformNotSupportedException))]
#endif
public void ConnectionString_Password_Synonyms ()
{
SqlConnection cn = new SqlConnection ();
@@ -909,6 +1002,9 @@ namespace MonoTests.System.Data.SqlClient
}
[Test]
#if FEATURE_NO_BSD_SOCKETS
[ExpectedException (typeof (PlatformNotSupportedException))]
#endif
public void ConnectionString_PersistSecurityInfo_Synonyms ()
{
SqlConnection cn = new SqlConnection ();
@@ -917,6 +1013,9 @@ namespace MonoTests.System.Data.SqlClient
}
[Test]
#if FEATURE_NO_BSD_SOCKETS
[ExpectedException (typeof (PlatformNotSupportedException))]
#endif
public void ConnectionString_UserID_Synonyms ()
{
SqlConnection cn = new SqlConnection ();
@@ -926,6 +1025,9 @@ namespace MonoTests.System.Data.SqlClient
}
[Test]
#if FEATURE_NO_BSD_SOCKETS
[ExpectedException (typeof (PlatformNotSupportedException))]
#endif
public void ConnectionString_UserInstance ()
{
SqlConnection cn = new SqlConnection ();
@@ -933,6 +1035,9 @@ namespace MonoTests.System.Data.SqlClient
}
[Test]
#if FEATURE_NO_BSD_SOCKETS
[ExpectedException (typeof (PlatformNotSupportedException))]
#endif
public void ConnectionString_UserInstance_Invalid ()
{
SqlConnection cn = new SqlConnection ();
@@ -950,6 +1055,9 @@ namespace MonoTests.System.Data.SqlClient
}
[Test]
#if FEATURE_NO_BSD_SOCKETS
[ExpectedException (typeof (PlatformNotSupportedException))]
#endif
public void ConnectionString_OtherKeywords ()
{
SqlConnection cn = new SqlConnection ();
@@ -973,6 +1081,9 @@ namespace MonoTests.System.Data.SqlClient
}
[Test]
#if FEATURE_NO_BSD_SOCKETS
[ExpectedException (typeof (PlatformNotSupportedException))]
#endif
public void Open_ConnectionString_Empty ()
{
SqlConnection cn = new SqlConnection ();
@@ -991,6 +1102,9 @@ namespace MonoTests.System.Data.SqlClient
}
[Test]
#if FEATURE_NO_BSD_SOCKETS
[ExpectedException (typeof (PlatformNotSupportedException))]
#endif
public void Open_ConnectionString_Null ()
{
SqlConnection cn = new SqlConnection ();
@@ -1009,6 +1123,9 @@ namespace MonoTests.System.Data.SqlClient
}
[Test]
#if FEATURE_NO_BSD_SOCKETS
[ExpectedException (typeof (PlatformNotSupportedException))]
#endif
public void Open_ConnectionString_Whitespace ()
{
SqlConnection cn = new SqlConnection ();
@@ -1027,6 +1144,9 @@ namespace MonoTests.System.Data.SqlClient
}
[Test]
#if FEATURE_NO_BSD_SOCKETS
[ExpectedException (typeof (PlatformNotSupportedException))]
#endif
public void ServerVersion_Connection_Closed ()
{
SqlConnection cn = new SqlConnection ();
@@ -1051,3 +1171,4 @@ namespace MonoTests.System.Data.SqlClient
}
}
}

View File

@@ -63,6 +63,9 @@ namespace MonoTests.System.Data.SqlClient
}
[Test] // SqlDataAdapter (SqlCommand)
#if FEATURE_NO_BSD_SOCKETS
[ExpectedException (typeof (PlatformNotSupportedException))]
#endif
public void Constructor2 ()
{
SqlCommand cmd = new SqlCommand ();
@@ -109,6 +112,9 @@ namespace MonoTests.System.Data.SqlClient
}
[Test] // SqlDataAdapter (string, SqlConnection)
#if FEATURE_NO_BSD_SOCKETS
[ExpectedException (typeof (PlatformNotSupportedException))]
#endif
public void Constructor3 ()
{
string selectCommandText = "SELECT * FROM Authors";
@@ -137,6 +143,9 @@ namespace MonoTests.System.Data.SqlClient
}
[Test] // SqlDataAdapter (string, SqlConnection)
#if FEATURE_NO_BSD_SOCKETS
[ExpectedException (typeof (PlatformNotSupportedException))]
#endif
public void Constructor3_SelectCommandText_Null ()
{
SqlConnection selectConnection = new SqlConnection ();
@@ -165,6 +174,9 @@ namespace MonoTests.System.Data.SqlClient
}
[Test] // SqlDataAdapter (string, SqlConnection)
#if FEATURE_NO_BSD_SOCKETS
[ExpectedException (typeof (PlatformNotSupportedException))]
#endif
public void Constructor3_SelectConnection_Null ()
{
string selectCommandText = "SELECT * FROM Authors";
@@ -192,6 +204,9 @@ namespace MonoTests.System.Data.SqlClient
}
[Test] // SqlDataAdapter (string, string)]
#if FEATURE_NO_BSD_SOCKETS
[ExpectedException (typeof (PlatformNotSupportedException))]
#endif
public void Constructor4 ()
{
string selectCommandText = "SELECT * FROM Authors";
@@ -221,6 +236,9 @@ namespace MonoTests.System.Data.SqlClient
}
[Test] // SqlDataAdapter (string, string)]
#if FEATURE_NO_BSD_SOCKETS
[ExpectedException (typeof (PlatformNotSupportedException))]
#endif
public void Constructor4_SelectCommandText_Null ()
{
string selectConnectionString = "server=SQLSRV;database=Mono";
@@ -250,6 +268,9 @@ namespace MonoTests.System.Data.SqlClient
}
[Test] // SqlDataAdapter (string, string)]
#if FEATURE_NO_BSD_SOCKETS
[ExpectedException (typeof (PlatformNotSupportedException))]
#endif
public void Constructor4_SelectConnectionString_Null ()
{
string selectCommandText = "SELECT * FROM Authors";
@@ -278,6 +299,9 @@ namespace MonoTests.System.Data.SqlClient
}
[Test]
#if FEATURE_NO_BSD_SOCKETS
[ExpectedException (typeof (PlatformNotSupportedException))]
#endif
public void DeleteCommand ()
{
SqlDataAdapter da = new SqlDataAdapter ();
@@ -293,6 +317,9 @@ namespace MonoTests.System.Data.SqlClient
}
[Test]
#if FEATURE_NO_BSD_SOCKETS
[ExpectedException (typeof (PlatformNotSupportedException))]
#endif
public void Dispose ()
{
SqlDataAdapter da = new SqlDataAdapter ();
@@ -311,6 +338,9 @@ namespace MonoTests.System.Data.SqlClient
}
[Test]
#if FEATURE_NO_BSD_SOCKETS
[ExpectedException (typeof (PlatformNotSupportedException))]
#endif
public void InsertCommand ()
{
SqlDataAdapter da = new SqlDataAdapter ();
@@ -326,6 +356,9 @@ namespace MonoTests.System.Data.SqlClient
}
[Test]
#if FEATURE_NO_BSD_SOCKETS
[ExpectedException (typeof (PlatformNotSupportedException))]
#endif
public void SelectCommand ()
{
SqlDataAdapter da = new SqlDataAdapter ();
@@ -369,6 +402,9 @@ namespace MonoTests.System.Data.SqlClient
}
[Test]
#if FEATURE_NO_BSD_SOCKETS
[ExpectedException (typeof (PlatformNotSupportedException))]
#endif
public void UpdateCommand ()
{
SqlDataAdapter da = new SqlDataAdapter ();

View File

@@ -45,6 +45,9 @@ namespace MonoTests.System.Data.SqlClient
public class SqlParameterTest
{
[Test]
#if FEATURE_NO_BSD_SOCKETS
[ExpectedException (typeof (PlatformNotSupportedException))]
#endif
public void Constructor1 ()
{
SqlParameter p = new SqlParameter ();
@@ -68,6 +71,9 @@ namespace MonoTests.System.Data.SqlClient
}
[Test]
#if FEATURE_NO_BSD_SOCKETS
[ExpectedException (typeof (PlatformNotSupportedException))]
#endif
public void Constructor2_Value_DateTime ()
{
DateTime value = new DateTime (2004, 8, 24);
@@ -94,6 +100,9 @@ namespace MonoTests.System.Data.SqlClient
}
[Test]
#if FEATURE_NO_BSD_SOCKETS
[ExpectedException (typeof (PlatformNotSupportedException))]
#endif
public void Constructor2_Value_DBNull ()
{
SqlParameter p = new SqlParameter ("address", DBNull.Value);
@@ -118,6 +127,9 @@ namespace MonoTests.System.Data.SqlClient
}
[Test]
#if FEATURE_NO_BSD_SOCKETS
[ExpectedException (typeof (PlatformNotSupportedException))]
#endif
public void Constructor2_Value_Null ()
{
SqlParameter p = new SqlParameter ("address", (Object) null);
@@ -141,6 +153,9 @@ namespace MonoTests.System.Data.SqlClient
}
[Test] // .ctor (String, SqlDbType, Int32, ParameterDirection, Byte, Byte, String, DataRowVersion, Boolean, Object, String, String, String)
#if FEATURE_NO_BSD_SOCKETS
[ExpectedException (typeof (PlatformNotSupportedException))]
#endif
public void Constructor7 ()
{
SqlParameter p1 = new SqlParameter ("p1Name", SqlDbType.VarChar, 20,
@@ -167,6 +182,9 @@ namespace MonoTests.System.Data.SqlClient
}
[Test]
#if FEATURE_NO_BSD_SOCKETS
[ExpectedException (typeof (PlatformNotSupportedException))]
#endif
public void CompareInfo ()
{
SqlParameter parameter = new SqlParameter ();
@@ -176,6 +194,9 @@ namespace MonoTests.System.Data.SqlClient
}
[Test]
#if FEATURE_NO_BSD_SOCKETS
[ExpectedException (typeof (PlatformNotSupportedException))]
#endif
public void InferType_Byte ()
{
Byte value = 0x0a;
@@ -187,6 +208,9 @@ namespace MonoTests.System.Data.SqlClient
}
[Test]
#if FEATURE_NO_BSD_SOCKETS
[ExpectedException (typeof (PlatformNotSupportedException))]
#endif
public void InferType_ByteArray ()
{
Byte [] value = new Byte [] { 0x0a, 0x0d };
@@ -289,6 +313,9 @@ namespace MonoTests.System.Data.SqlClient
}
[Test]
#if FEATURE_NO_BSD_SOCKETS
[ExpectedException (typeof (PlatformNotSupportedException))]
#endif
public void InferType_DateTime ()
{
DateTime value;
@@ -314,6 +341,9 @@ namespace MonoTests.System.Data.SqlClient
}
[Test]
#if FEATURE_NO_BSD_SOCKETS
[ExpectedException (typeof (PlatformNotSupportedException))]
#endif
public void InferType_Decimal ()
{
Decimal value;
@@ -339,6 +369,9 @@ namespace MonoTests.System.Data.SqlClient
}
[Test]
#if FEATURE_NO_BSD_SOCKETS
[ExpectedException (typeof (PlatformNotSupportedException))]
#endif
public void InferType_Double ()
{
Double value;
@@ -364,6 +397,9 @@ namespace MonoTests.System.Data.SqlClient
}
[Test]
#if FEATURE_NO_BSD_SOCKETS
[ExpectedException (typeof (PlatformNotSupportedException))]
#endif
public void InferType_Enum ()
{
SqlParameter param;
@@ -380,6 +416,9 @@ namespace MonoTests.System.Data.SqlClient
}
[Test]
#if FEATURE_NO_BSD_SOCKETS
[ExpectedException (typeof (PlatformNotSupportedException))]
#endif
public void InferType_Guid ()
{
Guid value = Guid.NewGuid ();
@@ -391,6 +430,9 @@ namespace MonoTests.System.Data.SqlClient
}
[Test]
#if FEATURE_NO_BSD_SOCKETS
[ExpectedException (typeof (PlatformNotSupportedException))]
#endif
public void InferType_Int16 ()
{
Int16 value;
@@ -416,6 +458,9 @@ namespace MonoTests.System.Data.SqlClient
}
[Test]
#if FEATURE_NO_BSD_SOCKETS
[ExpectedException (typeof (PlatformNotSupportedException))]
#endif
public void InferType_Int32 ()
{
Int32 value;
@@ -441,6 +486,9 @@ namespace MonoTests.System.Data.SqlClient
}
[Test]
#if FEATURE_NO_BSD_SOCKETS
[ExpectedException (typeof (PlatformNotSupportedException))]
#endif
public void InferType_Int64 ()
{
Int64 value;
@@ -506,6 +554,9 @@ namespace MonoTests.System.Data.SqlClient
}
[Test]
#if FEATURE_NO_BSD_SOCKETS
[ExpectedException (typeof (PlatformNotSupportedException))]
#endif
public void InferType_Object ()
{
Object value = new Object ();
@@ -517,6 +568,9 @@ namespace MonoTests.System.Data.SqlClient
}
[Test]
#if FEATURE_NO_BSD_SOCKETS
[ExpectedException (typeof (PlatformNotSupportedException))]
#endif
public void InferType_Single ()
{
Single value = Single.MaxValue;
@@ -528,6 +582,9 @@ namespace MonoTests.System.Data.SqlClient
}
[Test]
#if FEATURE_NO_BSD_SOCKETS
[ExpectedException (typeof (PlatformNotSupportedException))]
#endif
public void InferType_String ()
{
String value = "some text";
@@ -551,6 +608,9 @@ namespace MonoTests.System.Data.SqlClient
}
[Test]
#if FEATURE_NO_BSD_SOCKETS
[ExpectedException (typeof (PlatformNotSupportedException))]
#endif
public void LocaleId ()
{
SqlParameter parameter = new SqlParameter ();
@@ -560,6 +620,9 @@ namespace MonoTests.System.Data.SqlClient
}
[Test] // bug #320196
#if FEATURE_NO_BSD_SOCKETS
[ExpectedException (typeof (PlatformNotSupportedException))]
#endif
public void ParameterNullTest ()
{
SqlParameter param = new SqlParameter ("param", SqlDbType.Decimal);
@@ -574,6 +637,9 @@ namespace MonoTests.System.Data.SqlClient
}
[Test]
#if FEATURE_NO_BSD_SOCKETS
[ExpectedException (typeof (PlatformNotSupportedException))]
#endif
public void ParameterType ()
{
SqlParameter p;
@@ -632,6 +698,9 @@ namespace MonoTests.System.Data.SqlClient
}
[Test]
#if FEATURE_NO_BSD_SOCKETS
[ExpectedException (typeof (PlatformNotSupportedException))]
#endif
public void InferType_Boolean ()
{
Boolean value;
@@ -651,6 +720,9 @@ namespace MonoTests.System.Data.SqlClient
}
[Test]
#if FEATURE_NO_BSD_SOCKETS
[ExpectedException (typeof (PlatformNotSupportedException))]
#endif
public void ParameterName ()
{
SqlParameter p = new SqlParameter ();
@@ -676,6 +748,9 @@ namespace MonoTests.System.Data.SqlClient
}
[Test]
#if FEATURE_NO_BSD_SOCKETS
[ExpectedException (typeof (PlatformNotSupportedException))]
#endif
public void ResetDbType ()
{
SqlParameter p;
@@ -739,6 +814,9 @@ namespace MonoTests.System.Data.SqlClient
}
[Test]
#if FEATURE_NO_BSD_SOCKETS
[ExpectedException (typeof (PlatformNotSupportedException))]
#endif
public void ResetSqlDbType ()
{
//Parameter with an assigned value but no SqlDbType specified
@@ -779,6 +857,9 @@ namespace MonoTests.System.Data.SqlClient
}
[Test]
#if FEATURE_NO_BSD_SOCKETS
[ExpectedException (typeof (PlatformNotSupportedException))]
#endif
public void SourceColumn ()
{
SqlParameter p = new SqlParameter ();
@@ -804,6 +885,9 @@ namespace MonoTests.System.Data.SqlClient
}
[Test]
#if FEATURE_NO_BSD_SOCKETS
[ExpectedException (typeof (PlatformNotSupportedException))]
#endif
public void SourceColumnNullMapping ()
{
SqlParameter p = new SqlParameter ();
@@ -815,6 +899,9 @@ namespace MonoTests.System.Data.SqlClient
}
[Test]
#if FEATURE_NO_BSD_SOCKETS
[ExpectedException (typeof (PlatformNotSupportedException))]
#endif
public void SqlDbTypeTest ()
{
SqlParameter p = new SqlParameter ("zipcode", 3510);
@@ -829,6 +916,9 @@ namespace MonoTests.System.Data.SqlClient
}
[Test]
#if FEATURE_NO_BSD_SOCKETS
[ExpectedException (typeof (PlatformNotSupportedException))]
#endif
public void SqlDbTypeTest_Value_Invalid ()
{
SqlParameter p = new SqlParameter ("zipcode", 3510);
@@ -847,6 +937,9 @@ namespace MonoTests.System.Data.SqlClient
}
[Test]
#if FEATURE_NO_BSD_SOCKETS
[ExpectedException (typeof (PlatformNotSupportedException))]
#endif
public void SqlValue ()
{
SqlParameter parameter = new SqlParameter ();
@@ -970,6 +1063,9 @@ namespace MonoTests.System.Data.SqlClient
}
[Test]
#if FEATURE_NO_BSD_SOCKETS
[ExpectedException (typeof (PlatformNotSupportedException))]
#endif
public void SqlTypes_SqlBinary ()
{
SqlParameter parameter;
@@ -995,6 +1091,9 @@ namespace MonoTests.System.Data.SqlClient
}
[Test]
#if FEATURE_NO_BSD_SOCKETS
[ExpectedException (typeof (PlatformNotSupportedException))]
#endif
public void SqlTypes_SqlBoolean ()
{
SqlParameter parameter;
@@ -1020,6 +1119,9 @@ namespace MonoTests.System.Data.SqlClient
}
[Test]
#if FEATURE_NO_BSD_SOCKETS
[ExpectedException (typeof (PlatformNotSupportedException))]
#endif
public void SqlTypes_SqlByte ()
{
SqlParameter parameter;
@@ -1107,6 +1209,9 @@ namespace MonoTests.System.Data.SqlClient
}
[Test]
#if FEATURE_NO_BSD_SOCKETS
[ExpectedException (typeof (PlatformNotSupportedException))]
#endif
public void SqlTypes_SqlDateTime ()
{
SqlParameter parameter;
@@ -1132,6 +1237,9 @@ namespace MonoTests.System.Data.SqlClient
}
[Test]
#if FEATURE_NO_BSD_SOCKETS
[ExpectedException (typeof (PlatformNotSupportedException))]
#endif
public void SqlTypes_SqlDecimal ()
{
SqlParameter parameter;
@@ -1157,6 +1265,9 @@ namespace MonoTests.System.Data.SqlClient
}
[Test]
#if FEATURE_NO_BSD_SOCKETS
[ExpectedException (typeof (PlatformNotSupportedException))]
#endif
public void SqlTypes_SqlDouble ()
{
SqlParameter parameter;
@@ -1182,6 +1293,9 @@ namespace MonoTests.System.Data.SqlClient
}
[Test]
#if FEATURE_NO_BSD_SOCKETS
[ExpectedException (typeof (PlatformNotSupportedException))]
#endif
public void SqlTypes_SqlGuid ()
{
SqlParameter parameter;
@@ -1207,6 +1321,9 @@ namespace MonoTests.System.Data.SqlClient
}
[Test]
#if FEATURE_NO_BSD_SOCKETS
[ExpectedException (typeof (PlatformNotSupportedException))]
#endif
public void SqlTypes_SqlInt16 ()
{
SqlParameter parameter;
@@ -1232,6 +1349,9 @@ namespace MonoTests.System.Data.SqlClient
}
[Test]
#if FEATURE_NO_BSD_SOCKETS
[ExpectedException (typeof (PlatformNotSupportedException))]
#endif
public void SqlTypes_SqlInt32 ()
{
SqlParameter parameter;
@@ -1257,6 +1377,9 @@ namespace MonoTests.System.Data.SqlClient
}
[Test]
#if FEATURE_NO_BSD_SOCKETS
[ExpectedException (typeof (PlatformNotSupportedException))]
#endif
public void SqlTypes_SqlInt64 ()
{
SqlParameter parameter;
@@ -1282,6 +1405,9 @@ namespace MonoTests.System.Data.SqlClient
}
[Test]
#if FEATURE_NO_BSD_SOCKETS
[ExpectedException (typeof (PlatformNotSupportedException))]
#endif
public void SqlTypes_SqlMoney ()
{
SqlParameter parameter;
@@ -1307,6 +1433,9 @@ namespace MonoTests.System.Data.SqlClient
}
[Test]
#if FEATURE_NO_BSD_SOCKETS
[ExpectedException (typeof (PlatformNotSupportedException))]
#endif
public void SqlTypes_SqlSingle ()
{
SqlParameter parameter;
@@ -1332,6 +1461,9 @@ namespace MonoTests.System.Data.SqlClient
}
[Test]
#if FEATURE_NO_BSD_SOCKETS
[ExpectedException (typeof (PlatformNotSupportedException))]
#endif
public void SqlTypes_SqlString ()
{
SqlParameter parameter;
@@ -1357,6 +1489,9 @@ namespace MonoTests.System.Data.SqlClient
}
[Test]
#if FEATURE_NO_BSD_SOCKETS
[ExpectedException (typeof (PlatformNotSupportedException))]
#endif
public void SqlTypes_SqlXml ()
{
SqlParameter parameter;
@@ -1386,6 +1521,9 @@ namespace MonoTests.System.Data.SqlClient
}
[Test]
#if FEATURE_NO_BSD_SOCKETS
[ExpectedException (typeof (PlatformNotSupportedException))]
#endif
public void Value ()
{
SqlParameter p;
@@ -1429,6 +1567,9 @@ namespace MonoTests.System.Data.SqlClient
}
[Test]
#if FEATURE_NO_BSD_SOCKETS
[ExpectedException (typeof (PlatformNotSupportedException))]
#endif
public void XmlSchemaTest ()
{
SqlParameter p1 = new SqlParameter ();

View File

@@ -447,7 +447,7 @@ namespace MonoTests.System.Data
{
DataTable dt = DataProvider.CreateParentDataTable();
dt.Constraints.Add("UniqueConstraint",dt.Columns["ParentId"],true);
Assert.AreEqual(1,dt.Constraints.Count,1);
Assert.AreEqual(1,(double) dt.Constraints.Count,1);
Assert.AreEqual("UniqueConstraint",dt.Constraints[0].ConstraintName,"CN34");
}

File diff suppressed because it is too large Load Diff

View File

@@ -36,7 +36,7 @@ using System.ComponentModel;
namespace MonoTests.System.Data
{
[TestFixture]
public class DataRowViewTest : Assertion
public class DataRowViewTest
{
private DataView CreateTestView ()
{
@@ -96,8 +96,8 @@ namespace MonoTests.System.Data
DataView dv = new DataView (dt1);
DataRowView dvr = dv [0];
DataView v = dvr.CreateChildView (dr);
AssertEquals ("RowFilter", "", v.RowFilter);
AssertEquals ("Sort", "", v.Sort);
Assert.AreEqual ("", v.RowFilter, "RowFilter");
Assert.AreEqual ("", v.Sort, "Sort");
}
[Test]
@@ -110,12 +110,12 @@ namespace MonoTests.System.Data
DataView dv = new DataView (dt);
DataRowView drv = dv [0];
dt.Rows [0].BeginEdit ();
AssertEquals ("DataView.Item", true, drv.IsEdit);
Assert.AreEqual (true, drv.IsEdit, "DataView.Item");
drv = dv.AddNew ();
drv.Row ["col"] = "test";
drv.Row.CancelEdit ();
AssertEquals ("AddNew", false, drv.IsEdit);
Assert.AreEqual (false, drv.IsEdit, "AddNew");
}
[Test]
@@ -127,7 +127,7 @@ namespace MonoTests.System.Data
DataView dv = new DataView (dt);
DataRowView drv = dv [0];
dt.Rows [0].BeginEdit ();
AssertEquals ("DataView.Item", "val", drv ["col"]);
Assert.AreEqual ("val", drv ["col"], "DataView.Item");
}
[Test]
@@ -153,18 +153,18 @@ namespace MonoTests.System.Data
dt.Rows.Add (new object [] {1});
DataView dv = new DataView (dt);
DataRowView drv = dv.AddNew ();
AssertEquals (DataRowVersion.Current, drv.RowVersion);
AssertEquals (DataRowVersion.Current, dv [0].RowVersion);
Assert.AreEqual (DataRowVersion.Current, drv.RowVersion);
Assert.AreEqual (DataRowVersion.Current, dv [0].RowVersion);
drv ["col"] = "mod";
AssertEquals (DataRowVersion.Current, drv.RowVersion);
AssertEquals (DataRowVersion.Current, dv [0].RowVersion);
Assert.AreEqual (DataRowVersion.Current, drv.RowVersion);
Assert.AreEqual (DataRowVersion.Current, dv [0].RowVersion);
dt.AcceptChanges ();
AssertEquals (DataRowVersion.Current, drv.RowVersion);
AssertEquals (DataRowVersion.Current, dv [0].RowVersion);
Assert.AreEqual (DataRowVersion.Current, drv.RowVersion);
Assert.AreEqual (DataRowVersion.Current, dv [0].RowVersion);
drv.EndEdit ();
dv [0].EndEdit ();
AssertEquals (DataRowVersion.Current, drv.RowVersion);
AssertEquals (DataRowVersion.Current, dv [0].RowVersion);
Assert.AreEqual (DataRowVersion.Current, drv.RowVersion);
Assert.AreEqual (DataRowVersion.Current, dv [0].RowVersion);
}
}
}

View File

@@ -37,7 +37,7 @@ namespace MonoTests.System.Data
{
[TestFixture]
public class DataTableCollectionTest : Assertion {
public class DataTableCollectionTest {
// common variables here
private DataSet [] _dataset;
private DataTable [] _tables;
@@ -76,11 +76,11 @@ namespace MonoTests.System.Data
foreach( DataTable table in tbcol )
{
AssertEquals("test#1",_tables[i].TableName,table.TableName);
Assert.AreEqual(_tables[i].TableName,table.TableName,"test#1");
j=0;
foreach( DataColumn column in table.Columns )
{
AssertEquals("test#2",_tables[i].Columns[j].ColumnName,column.ColumnName);
Assert.AreEqual(_tables[i].Columns[j].ColumnName,column.ColumnName,"test#2");
j++;
}
i++;
@@ -90,11 +90,11 @@ namespace MonoTests.System.Data
i=0;
foreach( DataTable table in tbcol )
{
AssertEquals("test#3",_tables[i].TableName,table.TableName);
Assert.AreEqual(_tables[i].TableName,table.TableName,"test#3");
j=0;
foreach( DataColumn column in table.Columns )
{
AssertEquals("test#4",_tables[i].Columns[j].ColumnName,column.ColumnName);
Assert.AreEqual(_tables[i].Columns[j].ColumnName,column.ColumnName,"test#4");
j++;
}
i++;
@@ -143,9 +143,9 @@ namespace MonoTests.System.Data
{
DataTableCollection tbcol = _dataset[0].Tables;
tbcol.Add(_tables[0]);
AssertEquals("test#1",1, tbcol.Count);
Assert.AreEqual(1,tbcol.Count, "test#1");
tbcol.Add(_tables[1]);
AssertEquals("test#2",2, tbcol.Count);
Assert.AreEqual(2,tbcol.Count, "test#2");
}
[Test]
@@ -159,11 +159,11 @@ namespace MonoTests.System.Data
i=0;
foreach( DataTable table in tbcol )
{
AssertEquals("test#1",_tables[i].TableName,table.TableName);
Assert.AreEqual(_tables[i].TableName,table.TableName,"test#1");
j=0;
foreach( DataColumn column in table.Columns )
{
AssertEquals("test#2",_tables[i].Columns[j].ColumnName,column.ColumnName);
Assert.AreEqual(_tables[i].Columns[j].ColumnName,column.ColumnName,"test#2");
j++;
}
i++;
@@ -179,11 +179,11 @@ namespace MonoTests.System.Data
tbcol.AddRange(_tables);
DataTable tbl = null;
/* checking for a recently input table, expecting true */
AssertEquals("test#1",true,tbcol.CanRemove(_tables[0]));
Assert.AreEqual(true,tbcol.CanRemove(_tables[0]),"test#1");
/* trying to check with a null reference, expecting false */
AssertEquals("test#2",false,tbcol.CanRemove(tbl));
Assert.AreEqual(false,tbcol.CanRemove(tbl),"test#2");
/* trying to check with a table that does not exist in collection, expecting false */
AssertEquals("test#3",false,tbcol.CanRemove(new DataTable("newTable")));
Assert.AreEqual(false,tbcol.CanRemove(new DataTable("newTable")),"test#3");
}
[Test]
@@ -197,27 +197,27 @@ namespace MonoTests.System.Data
/* removing a recently added table */
int count = tbcol.Count;
tbcol.Remove(_tables[0]);
AssertEquals("test#1",count-1,tbcol.Count);
Assert.AreEqual(count-1,tbcol.Count,"test#1");
DataTable tbl = null;
/* removing a null reference. must generate an Exception */
try
{
tbcol.Remove(tbl);
Fail("Err:: tbcol.Rmove(null) must fail");
Assert.Fail("Err:: tbcol.Rmove(null) must fail");
}
catch(Exception e)
{
AssertEquals ("test#2", typeof (ArgumentNullException), e.GetType());
Assert.AreEqual (typeof (ArgumentNullException), e.GetType(), "test#2");
}
/* removing a table that is not there in collection */
try
{
tbcol.Remove(new DataTable("newTable"));
Fail("Err:: cannot remove a table that is not there in collection");
Assert.Fail("Err:: cannot remove a table that is not there in collection");
}
catch(Exception e)
{
AssertEquals ("test#3", typeof (ArgumentException), e.GetType());
Assert.AreEqual (typeof (ArgumentException), e.GetType(), "test#3");
}
}
@@ -227,11 +227,11 @@ namespace MonoTests.System.Data
DataTableCollection tbcol = _dataset[0].Tables;
tbcol.Add(_tables[0]);
tbcol.Clear();
AssertEquals("Test#1",0,tbcol.Count);
Assert.AreEqual(0,tbcol.Count,"Test#1");
tbcol.AddRange(new DataTable[] {_tables[0],_tables[1]});
tbcol.Clear();
AssertEquals("Test#2",0,tbcol.Count);
Assert.AreEqual(0,tbcol.Count,"Test#2");
}
[Test]
public void Contains()
@@ -242,11 +242,11 @@ namespace MonoTests.System.Data
tbcol.AddRange(_tables);
string tblname = "";
/* checking for a recently input table, expecting true */
AssertEquals("test#1",true,tbcol.Contains(_tables[0].TableName));
Assert.AreEqual(true,tbcol.Contains(_tables[0].TableName),"test#1");
/* trying to check with a empty string, expecting false */
AssertEquals("test#2",false,tbcol.Contains(tblname));
Assert.AreEqual(false,tbcol.Contains(tblname),"test#2");
/* trying to check for a table that donot exist, expecting false */
AssertEquals("test#3",false,tbcol.Contains("InvalidTableName"));
Assert.AreEqual(false,tbcol.Contains("InvalidTableName"),"test#3");
}
[Test]
@@ -261,21 +261,21 @@ namespace MonoTests.System.Data
DataTable [] array = new DataTable[4];
/* copying to the beginning of the array */
tbcol.CopyTo(array,0);
AssertEquals ("test#01", 4, array.Length);
AssertEquals ("test#02", "Table1", array[0].TableName);
AssertEquals ("test#03", "Table2", array[1].TableName);
AssertEquals ("test#04", "Table3", array[2].TableName);
AssertEquals ("test#05", "Table4", array[3].TableName);
Assert.AreEqual (4, array.Length, "test#01");
Assert.AreEqual ("Table1", array[0].TableName, "test#02");
Assert.AreEqual ("Table2", array[1].TableName, "test#03");
Assert.AreEqual ("Table3", array[2].TableName, "test#04");
Assert.AreEqual ("Table4", array[3].TableName, "test#05");
/* copying with in a array */
DataTable [] array1 = new DataTable[6];
tbcol.CopyTo(array1,2);
AssertEquals("test#06",null,array1[0]);
AssertEquals("test#07",null,array1[1]);
AssertEquals("test#08","Table1",array1[2].TableName);
AssertEquals("test#09","Table2",array1[3].TableName);
AssertEquals("test#10","Table3",array1[4].TableName);
AssertEquals("test#11","Table4",array1[5].TableName);
Assert.AreEqual(null,array1[0],"test#06");
Assert.AreEqual(null,array1[1],"test#07");
Assert.AreEqual("Table1",array1[2].TableName,"test#08");
Assert.AreEqual("Table2",array1[3].TableName,"test#09");
Assert.AreEqual("Table3",array1[4].TableName,"test#10");
Assert.AreEqual("Table4",array1[5].TableName,"test#11");
}
[Test]
public void Equals()
@@ -287,16 +287,16 @@ namespace MonoTests.System.Data
tbcol2.Add(_tables[1]);
tbcol3 = tbcol1;
AssertEquals("test#1",true,tbcol1.Equals(tbcol1));
AssertEquals("test#2",true,tbcol1.Equals(tbcol3));
AssertEquals("test#3",true,tbcol3.Equals(tbcol1));
Assert.AreEqual(true,tbcol1.Equals(tbcol1),"test#1");
Assert.AreEqual(true,tbcol1.Equals(tbcol3),"test#2");
Assert.AreEqual(true,tbcol3.Equals(tbcol1),"test#3");
AssertEquals("test#4",false,tbcol1.Equals(tbcol2));
AssertEquals("test#5",false,tbcol2.Equals(tbcol1));
Assert.AreEqual(false,tbcol1.Equals(tbcol2),"test#4");
Assert.AreEqual(false,tbcol2.Equals(tbcol1),"test#5");
AssertEquals("test#6",true,Object.Equals(tbcol1,tbcol3));
AssertEquals("test#7",true,Object.Equals(tbcol1,tbcol1));
AssertEquals("test#8",false,Object.Equals(tbcol1,tbcol2));
Assert.AreEqual(true,Object.Equals(tbcol1,tbcol3),"test#6");
Assert.AreEqual(true,Object.Equals(tbcol1,tbcol1),"test#7");
Assert.AreEqual(false,Object.Equals(tbcol1,tbcol2),"test#8");
}
[Test]
public void IndexOf()
@@ -306,16 +306,16 @@ namespace MonoTests.System.Data
tbcol.Add("table1");
tbcol.Add("table2");
AssertEquals("test#1",0,tbcol.IndexOf(_tables[0]));
AssertEquals("test#2",-1,tbcol.IndexOf(_tables[1]));
AssertEquals("test#3",1,tbcol.IndexOf("table1"));
AssertEquals("test#4",2,tbcol.IndexOf("table2"));
Assert.AreEqual(0,tbcol.IndexOf(_tables[0]),"test#1");
Assert.AreEqual(-1,tbcol.IndexOf(_tables[1]),"test#2");
Assert.AreEqual(1,tbcol.IndexOf("table1"),"test#3");
Assert.AreEqual(2,tbcol.IndexOf("table2"),"test#4");
AssertEquals("test#5",0,tbcol.IndexOf(tbcol[0]));
AssertEquals("test#6",1,tbcol.IndexOf(tbcol[1]));
AssertEquals("test#7",-1,tbcol.IndexOf("_noTable_"));
Assert.AreEqual(0,tbcol.IndexOf(tbcol[0]),"test#5");
Assert.AreEqual(1,tbcol.IndexOf(tbcol[1]),"test#6");
Assert.AreEqual(-1,tbcol.IndexOf("_noTable_"),"test#7");
DataTable tb = new DataTable("new_table");
AssertEquals("test#8",-1,tbcol.IndexOf(tb));
Assert.AreEqual(-1,tbcol.IndexOf(tb),"test#8");
}
[Test]
@@ -328,7 +328,7 @@ namespace MonoTests.System.Data
try
{
tbcol.RemoveAt(-1);
Fail("the index was out of bound: must have failed");
Assert.Fail("the index was out of bound: must have failed");
}
catch(IndexOutOfRangeException e)
{
@@ -336,15 +336,15 @@ namespace MonoTests.System.Data
try
{
tbcol.RemoveAt(101);
Fail("the index was out of bound: must have failed");
Assert.Fail("the index was out of bound: must have failed");
}
catch(IndexOutOfRangeException e)
{
}
tbcol.RemoveAt (1);
AssertEquals ("test#5", 1, tbcol.Count);
Assert.AreEqual (1, tbcol.Count, "test#5");
tbcol.RemoveAt (0);
AssertEquals ("test#6", 0, tbcol.Count);
Assert.AreEqual (0, tbcol.Count, "test#6");
}
[Test]
@@ -354,46 +354,46 @@ namespace MonoTests.System.Data
tbcol.Add("Table1");
tbcol.Add("Table2");
tbcol.Add("Table3");
AssertEquals("test#1","System.Data.DataTableCollection",tbcol.ToString());
Assert.AreEqual("System.Data.DataTableCollection",tbcol.ToString(),"test#1");
}
[Test]
public void TableDataSetNamespaces ()
{
DataTable dt = new DataTable ("dt1");
AssertEquals ("#1-1", String.Empty, dt.Namespace);
AssertNull ("#1-2", dt.DataSet);
Assert.AreEqual (String.Empty, dt.Namespace, "#1-1");
Assert.IsNull (dt.DataSet, "#1-2");
DataSet ds1 = new DataSet ("ds1");
ds1.Tables.Add (dt);
AssertEquals ("#2-1", String.Empty, dt.Namespace);
AssertEquals ("#2-2", ds1, dt.DataSet);
Assert.AreEqual (String.Empty, dt.Namespace, "#2-1");
Assert.AreEqual (ds1, dt.DataSet, "#2-2");
ds1.Namespace = "ns1";
AssertEquals ("#3", "ns1", dt.Namespace);
Assert.AreEqual ("ns1", dt.Namespace, "#3");
// back to null again
ds1.Tables.Remove (dt);
AssertEquals ("#4-1", String.Empty, dt.Namespace);
AssertNull ("#4-2", dt.DataSet);
Assert.AreEqual (String.Empty, dt.Namespace, "#4-1");
Assert.IsNull (dt.DataSet, "#4-2");
// This table is being added to _already namespaced_
// dataset.
dt = new DataTable ("dt2");
ds1.Tables.Add (dt);
AssertEquals ("#5-1", "ns1", dt.Namespace);
AssertEquals ("#5-2", ds1, dt.DataSet);
Assert.AreEqual ("ns1", dt.Namespace, "#5-1");
Assert.AreEqual (ds1, dt.DataSet, "#5-2");
ds1.Tables.Remove (dt);
AssertEquals ("#6-1", String.Empty, dt.Namespace);
AssertNull ("#6-2", dt.DataSet);
Assert.AreEqual (String.Empty, dt.Namespace, "#6-1");
Assert.IsNull (dt.DataSet, "#6-2");
DataSet ds2 = new DataSet ("ds2");
ds2.Namespace = "ns2";
ds2.Tables.Add (dt);
AssertEquals ("#7-1", "ns2", dt.Namespace);
AssertEquals ("#7-2", ds2, dt.DataSet);
Assert.AreEqual ("ns2", dt.Namespace, "#7-1");
Assert.AreEqual (ds2, dt.DataSet, "#7-2");
}
}
}

View File

@@ -1 +1 @@
a44a225534eee1f385f9f5b2ef5e9f5b07097656
388f547212ad45907957b767ab265f33591a724b

View File

@@ -36,7 +36,7 @@ using System.ComponentModel;
namespace MonoTests.System.Data
{
[TestFixture]
public class DataViewManagerTest : Assertion
public class DataViewManagerTest
{
[Test]
public void Ctor ()
@@ -46,40 +46,40 @@ namespace MonoTests.System.Data
string deleted = @"<DataViewSettingCollectionString><table2-1 Sort="""" RowFilter="""" RowStateFilter=""Deleted""/></DataViewSettingCollectionString>";
DataViewManager m = new DataViewManager (null);
AssertNull (m.DataSet);
AssertEquals ("", m.DataViewSettingCollectionString);
AssertNotNull (m.DataViewSettings);
Assert.IsNull (m.DataSet);
Assert.AreEqual ("", m.DataViewSettingCollectionString);
Assert.IsNotNull (m.DataViewSettings);
DataSet ds = new DataSet ("ds");
m.DataSet = ds;
AssertEquals ("default#1", defaultString,
m.DataViewSettingCollectionString);
Assert.AreEqual (defaultString, m.DataViewSettingCollectionString,
"default#1");
DataSet ds2 = new DataSet ("ds2");
AssertEquals ("default#2", defaultString,
ds.DefaultViewManager.DataViewSettingCollectionString);
Assert.AreEqual (defaultString, ds.DefaultViewManager.DataViewSettingCollectionString,
"default#2");
DataTable dt2_1 = new DataTable ("table2-1");
dt2_1.Namespace ="urn:foo"; // It is ignored though.
ds2.Tables.Add (dt2_1);
m.DataSet = ds2;
AssertEquals ("#3", current, m.DataViewSettingCollectionString);
Assert.AreEqual (current, m.DataViewSettingCollectionString, "#3");
// Note that " Deleted " is trimmed.
m.DataViewSettingCollectionString = @"<DataViewSettingCollectionString><table2-1 Sort='' RowFilter='' RowStateFilter=' Deleted '/></DataViewSettingCollectionString>";
AssertEquals ("#4", deleted, m.DataViewSettingCollectionString);
Assert.AreEqual (deleted, m.DataViewSettingCollectionString, "#4");
m.DataSet = ds2; //resets modified string.
AssertEquals ("#5", current, m.DataViewSettingCollectionString);
Assert.AreEqual (current, m.DataViewSettingCollectionString, "#5");
m.DataViewSettingCollectionString = @"<DataViewSettingCollectionString><table2-1 Sort='' RowFilter='' RowStateFilter='Deleted'/></DataViewSettingCollectionString>";
// it does not clear anything.
m.DataViewSettingCollectionString = "<DataViewSettingCollectionString/>";
AssertEquals ("#6", deleted, m.DataViewSettingCollectionString);
Assert.AreEqual (deleted, m.DataViewSettingCollectionString, "#6");
// text node is not rejected (ignored).
// RowFilter is not examined.
m.DataViewSettingCollectionString = "<DataViewSettingCollectionString>blah<table2-1 RowFilter='a=b' ApplyDefaultSort='true' /></DataViewSettingCollectionString>";
// LAMESPEC: MS.NET ignores ApplyDefaultSort.
// AssertEquals ("#7", @"<DataViewSettingCollectionString><table2-1 Sort="""" RowFilter=""a=b"" RowStateFilter=""Deleted""/></DataViewSettingCollectionString>", m.DataViewSettingCollectionString);
// Assert.AreEqual (@"<DataViewSettingCollectionString><table2-1 Sort="""" RowFilter=""a=b"" RowStateFilter=""Deleted""/></DataViewSettingCollectionString>", m.DataViewSettingCollectionString, "#7");
}
[Test]

View File

@@ -42,7 +42,7 @@ using System.IO;
namespace MonoTests.System.Data
{
[TestFixture]
public class DataViewTest : Assertion
public class DataViewTest
{
DataTable dataTable;
DataView dataView;
@@ -145,7 +145,7 @@ namespace MonoTests.System.Data
dv.Sort = "abc";
dv.Sort = string.Empty;
dv.Sort = "abc";
AssertEquals ("test#01", "abc", dv.Sort);
Assert.AreEqual ("abc", dv.Sort, "test#01");
}
[Test]
@@ -154,24 +154,24 @@ namespace MonoTests.System.Data
DataView dv1,dv2,dv3;
dv1 = new DataView ();
// AssertEquals ("test#01",null,dv1.Table);
AssertEquals ("test#02",true,dv1.AllowNew);
AssertEquals ("test#03",true,dv1.AllowEdit);
AssertEquals ("test#04",true,dv1.AllowDelete);
AssertEquals ("test#05",false,dv1.ApplyDefaultSort);
AssertEquals ("test#06",string.Empty,dv1.RowFilter);
AssertEquals ("test#07",DataViewRowState.CurrentRows,dv1.RowStateFilter);
AssertEquals ("test#08",string.Empty,dv1.Sort);
Assert.AreEqual (true,dv1.AllowNew,"test#02");;
Assert.AreEqual (true,dv1.AllowEdit,"test#03");;
Assert.AreEqual (true,dv1.AllowDelete,"test#04");;
Assert.AreEqual (false,dv1.ApplyDefaultSort,"test#05");;
Assert.AreEqual (string.Empty,dv1.RowFilter,"test#06");;
Assert.AreEqual (DataViewRowState.CurrentRows,dv1.RowStateFilter,"test#07");;
Assert.AreEqual (string.Empty,dv1.Sort,"test#08");;
dv2 = new DataView (dataTable);
AssertEquals ("test#09","itemTable",dv2.Table.TableName);
AssertEquals ("test#10",string.Empty,dv2.Sort);
AssertEquals ("test#11",false,dv2.ApplyDefaultSort);
AssertEquals ("test#12",dataTable.Rows[0],dv2[0].Row);
Assert.AreEqual ("itemTable",dv2.Table.TableName,"test#09");;
Assert.AreEqual (string.Empty,dv2.Sort,"test#10");;
Assert.AreEqual (false,dv2.ApplyDefaultSort,"test#11");;
Assert.AreEqual (dataTable.Rows[0],dv2[0].Row,"test#12");;
dv3 = new DataView (dataTable,"","itemId DESC",DataViewRowState.CurrentRows);
AssertEquals ("test#13","",dv3.RowFilter);
AssertEquals ("test#14","itemId DESC",dv3.Sort);
AssertEquals ("test#15",DataViewRowState.CurrentRows,dv3.RowStateFilter);
Assert.AreEqual ("",dv3.RowFilter,"test#13");;
Assert.AreEqual ("itemId DESC",dv3.Sort,"test#14");;
Assert.AreEqual (DataViewRowState.CurrentRows,dv3.RowStateFilter,"test#15");;
//AssertEquals ("test#16",dataTable.Rows.[(dataTable.Rows.Count-1)],dv3[0]);
}
@@ -179,20 +179,20 @@ namespace MonoTests.System.Data
public void TestValue ()
{
DataView TestView = new DataView (dataTable);
Assertion.AssertEquals ("Dv #1", "item 1", TestView [0]["itemId"]);
Assert.AreEqual ("item 1", TestView [0]["itemId"], "Dv #1");
}
[Test]
public void TestCount ()
{
DataView TestView = new DataView (dataTable);
Assertion.AssertEquals ("Dv #3", 5, TestView.Count);
Assert.AreEqual (5, TestView.Count, "Dv #3");
}
[Test]
public void AllowNew ()
{
AssertEquals ("test#01",true,dataView.AllowNew);
Assert.AreEqual (true, dataView.AllowNew, "test#01");
}
[Test]
@@ -203,7 +203,7 @@ namespace MonoTests.System.Data
dataView.ApplyDefaultSort = true;
// dataView.Sort = "itemName";
// AssertEquals ("test#01","item 1",dataView[0]["itemId"]);
AssertEquals ("test#02",ListChangedType.Reset,listChangedArgs.ListChangedType);
Assert.AreEqual (ListChangedType.Reset,listChangedArgs.ListChangedType, "test#02");
// UnComment the line below to see if dataView is sorted
// PrintTableOrView (dataView,"* OnApplyDefaultSort");
}
@@ -212,7 +212,7 @@ namespace MonoTests.System.Data
public void RowStateFilter ()
{
dataView.RowStateFilter = DataViewRowState.Deleted;
AssertEquals ("test#01",ListChangedType.Reset,listChangedArgs.ListChangedType);
Assert.AreEqual (ListChangedType.Reset,listChangedArgs.ListChangedType, "test#01");
}
[Test]
@@ -239,16 +239,16 @@ namespace MonoTests.System.Data
dataView [0] ["col1"] = -1;
dataView.RowStateFilter = DataViewRowState.ModifiedOriginal;
v = dataView [0] [0].ToString ();
AssertEquals ("ModifiedOriginal.Count", 1, dataView.Count);
AssertEquals ("ModifiedOriginal.Value", "1", v);
Assert.AreEqual (1, dataView.Count, "ModifiedOriginal.Count");
Assert.AreEqual ("1", v, "ModifiedOriginal.Value");
// Deleting the row
dataView.Delete (0);
dataView.RowStateFilter = DataViewRowState.Deleted;
v = dataView [0] [0].ToString ();
AssertEquals ("Deleted.Count", 1, dataView.Count);
AssertEquals ("Deleted.Value", "1", v);
Assert.AreEqual (1, dataView.Count, "Deleted.Count");
Assert.AreEqual ("1", v, "Deleted.Value");
}
//xamarin bug #18898 # / novell bug #595899
@@ -276,10 +276,10 @@ namespace MonoTests.System.Data
another_new_row[0] = "9";
another_new_row[1] = "10";
AssertEquals ("#1", dv[2][0], "9");
Assert.AreEqual (dv[2][0], "9", "#1");
//This should not throw a System.Data.VersionNotFoundException: "There is no Proposed data to accces"
AssertEquals ("#1", dv[1][0], "7");
Assert.AreEqual (dv[1][0], "7", "#1");
}
@@ -288,7 +288,7 @@ namespace MonoTests.System.Data
{
DataView dataview = new DataView ();
PropertyDescriptorCollection col = ((ITypedList)dataview).GetItemProperties (null);
AssertEquals ("1", 0, col.Count);
Assert.AreEqual (0, col.Count, "1");
}
#region Sort Tests
@@ -296,7 +296,7 @@ namespace MonoTests.System.Data
public void SortListChangedTest ()
{
dataView.Sort = "itemName DESC";
AssertEquals ("test#01",ListChangedType.Reset,listChangedArgs.ListChangedType);
Assert.AreEqual (ListChangedType.Reset,listChangedArgs.ListChangedType, "test#01");
// UnComment the line below to see if dataView is sorted
// PrintTableOrView (dataView);
}
@@ -338,60 +338,60 @@ namespace MonoTests.System.Data
DataView dataView = dataTable.DefaultView;
string s = "Default sorting: ";
AssertEquals (s + "First entry has wrong item", 1, dataView[0][0]);
AssertEquals (s + "Second entry has wrong item", 0, dataView[1][0]);
AssertEquals (s + "Third entry has wrong item", 3, dataView[2][0]);
AssertEquals (s + "Fourth entry has wrong item", 2, dataView[3][0]);
Assert.AreEqual (1, dataView[0][0], s + "First entry has wrong item");
Assert.AreEqual (0, dataView[1][0], s + "Second entry has wrong item");
Assert.AreEqual (3, dataView[2][0], s + "Third entry has wrong item");
Assert.AreEqual (2, dataView[3][0], s + "Fourth entry has wrong item");
s = "Ascending sorting 1: ";
dataView.Sort = "itemId ASC";
AssertEquals (s + "First entry has wrong item", 0, dataView[0][0]);
AssertEquals (s + "Second entry has wrong item", 1, dataView[1][0]);
AssertEquals (s + "Third entry has wrong item", 2, dataView[2][0]);
AssertEquals (s + "Fourth entry has wrong item", 3, dataView[3][0]);
Assert.AreEqual (0, dataView[0][0], s + "First entry has wrong item");
Assert.AreEqual (1, dataView[1][0], s + "Second entry has wrong item");
Assert.AreEqual (2, dataView[2][0], s + "Third entry has wrong item");
Assert.AreEqual (3, dataView[3][0], s + "Fourth entry has wrong item");
// bug #77104 (2-5)
s = "Ascending sorting 2: ";
dataView.Sort = "itemId ASC";
AssertEquals (s + "First entry has wrong item", 0, dataView[0][0]);
AssertEquals (s + "Second entry has wrong item", 1, dataView[1][0]);
AssertEquals (s + "Third entry has wrong item", 2, dataView[2][0]);
AssertEquals (s + "Fourth entry has wrong item", 3, dataView[3][0]);
Assert.AreEqual (0, dataView[0][0], s + "First entry has wrong item");
Assert.AreEqual (1, dataView[1][0], s + "Second entry has wrong item");
Assert.AreEqual (2, dataView[2][0], s + "Third entry has wrong item");
Assert.AreEqual (3, dataView[3][0], s + "Fourth entry has wrong item");
s = "Ascending sorting 3: ";
dataView.Sort = "[itemId] ASC";
AssertEquals (s + "First entry has wrong item", 0, dataView[0][0]);
AssertEquals (s + "Second entry has wrong item", 1, dataView[1][0]);
AssertEquals (s + "Third entry has wrong item", 2, dataView[2][0]);
AssertEquals (s + "Fourth entry has wrong item", 3, dataView[3][0]);
Assert.AreEqual (0, dataView[0][0], s + "First entry has wrong item");
Assert.AreEqual (1, dataView[1][0], s + "Second entry has wrong item");
Assert.AreEqual (2, dataView[2][0], s + "Third entry has wrong item");
Assert.AreEqual (3, dataView[3][0], s + "Fourth entry has wrong item");
s = "Ascending sorting 4: ";
dataView.Sort = "[itemId] ASC";
AssertEquals (s + "First entry has wrong item", 0, dataView[0][0]);
AssertEquals (s + "Second entry has wrong item", 1, dataView[1][0]);
AssertEquals (s + "Third entry has wrong item", 2, dataView[2][0]);
AssertEquals (s + "Fourth entry has wrong item", 3, dataView[3][0]);
Assert.AreEqual (0, dataView[0][0], s + "First entry has wrong item");
Assert.AreEqual (1, dataView[1][0], s + "Second entry has wrong item");
Assert.AreEqual (2, dataView[2][0], s + "Third entry has wrong item");
Assert.AreEqual (3, dataView[3][0], s + "Fourth entry has wrong item");
s = "Ascending sorting 5: ";
try {
dataView.Sort = "itemId \tASC";
AssertEquals (s + "Tab cannot be a separator" , true, false);
Assert.AreEqual (true, false, s + "Tab cannot be a separator");
}catch (IndexOutOfRangeException e) {
}
s = "Descending sorting : ";
dataView.Sort = "itemId DESC";
AssertEquals (s + "First entry has wrong item", 3, dataView[0][0]);
AssertEquals (s + "Second entry has wrong item", 2, dataView[1][0]);
AssertEquals (s + "Third entry has wrong item", 1, dataView[2][0]);
AssertEquals (s + "Fourth entry has wrong item", 0, dataView[3][0]);
Assert.AreEqual (3, dataView[0][0], s + "First entry has wrong item");
Assert.AreEqual (2, dataView[1][0], s + "Second entry has wrong item");
Assert.AreEqual (1, dataView[2][0], s + "Third entry has wrong item");
Assert.AreEqual (0, dataView[3][0], s + "Fourth entry has wrong item");
s = "Reverted to default sorting: ";
dataView.Sort = null;
AssertEquals (s + "First entry has wrong item", 1, dataView[0][0]);
AssertEquals (s + "Second entry has wrong item", 0, dataView[1][0]);
AssertEquals (s + "Third entry has wrong item", 3, dataView[2][0]);
AssertEquals (s + "Fourth entry has wrong item", 2, dataView[3][0]);
Assert.AreEqual (1, dataView[0][0], s + "First entry has wrong item");
Assert.AreEqual (0, dataView[1][0], s + "Second entry has wrong item");
Assert.AreEqual (3, dataView[2][0], s + "Third entry has wrong item");
Assert.AreEqual (2, dataView[3][0], s + "Fourth entry has wrong item");
}
#endregion // Sort Tests
@@ -409,21 +409,21 @@ namespace MonoTests.System.Data
{
dataView.AllowNew = true;
DataRowView drv = dataView.AddNew ();
AssertEquals ("test#01",ListChangedType.ItemAdded,listChangedArgs.ListChangedType);
AssertEquals ("test#02",-1,listChangedArgs.OldIndex);
AssertEquals ("test#03",5,listChangedArgs.NewIndex);
AssertEquals ("test#04",drv["itemName"],dataView [dataView.Count - 1]["itemName"]);
Assert.AreEqual (ListChangedType.ItemAdded,listChangedArgs.ListChangedType, "test#01");
Assert.AreEqual (-1,listChangedArgs.OldIndex, "test#02");
Assert.AreEqual (5,listChangedArgs.NewIndex, "test#03");
Assert.AreEqual (drv["itemName"],dataView [dataView.Count - 1]["itemName"], "test#04");
listChangedArgs = null;
drv["itemId"] = "item " + 1001;
drv["itemName"] = "name " + rndm.Next();
drv["itemPrice"] = "Rs. " + (rndm.Next() % 1000);
drv["itemCategory"] = "Cat " + ((rndm.Next() % 10) + 1);
// Actually no events are arisen when items are set.
AssertNull ("test#05", listChangedArgs);
Assert.IsNull (listChangedArgs, "test#05");
drv.CancelEdit ();
AssertEquals ("test#06",ListChangedType.ItemDeleted,listChangedArgs.ListChangedType);
AssertEquals ("test#07",-1,listChangedArgs.OldIndex);
AssertEquals ("test#08",5,listChangedArgs.NewIndex);
Assert.AreEqual (ListChangedType.ItemDeleted,listChangedArgs.ListChangedType, "test#06");
Assert.AreEqual (-1,listChangedArgs.OldIndex, "test#07");
Assert.AreEqual (5,listChangedArgs.NewIndex, "test#08");
}
[Test]
@@ -439,15 +439,15 @@ namespace MonoTests.System.Data
table.Columns.AddRange (new DataColumn[] {col1,col2});
dv.Table = table;
AssertNull ("#1", dv.Table);
Assert.IsNull (dv.Table, "#1");
dv.EndInit ();
AssertNull ("#2", dv.Table); // still.
AssertEquals ("#3", 0, table.Columns.Count);
Assert.IsNull (dv.Table, "#2"); // still.
Assert.AreEqual (0, table.Columns.Count, "#3");
table.EndInit ();
AssertEquals ("#5", table, dv.Table);
AssertEquals ("#4", 2, table.Columns.Count);
Assert.AreEqual (table, dv.Table, "#4");
Assert.AreEqual (2, table.Columns.Count, "#5");
}
private bool dvInitialized;
@@ -472,19 +472,19 @@ namespace MonoTests.System.Data
table.Columns.AddRange (new DataColumn[] {col1,col2});
dv.Table = table;
AssertNull ("#1", dv.Table);
Assert.IsNull (dv.Table, "#1");
dv.EndInit ();
AssertNull ("#2", dv.Table);
AssertEquals ("#3", 0, table.Columns.Count);
Assert.IsNull (dv.Table, "#2");
Assert.AreEqual (0, table.Columns.Count, "#3");
table.EndInit ();
dv.Initialized -= new EventHandler (OnDataViewInitialized); // this should not be unregistered before table.EndInit().
AssertEquals ("#4", 2, table.Columns.Count);
AssertEquals ("#6", table, dv.Table);
AssertEquals ("DataViewInitialized #5", true, dvInitialized);
Assert.AreEqual (2, table.Columns.Count, "#4");
Assert.AreEqual (table, dv.Table, "#6");
Assert.AreEqual (true, dvInitialized, "DataViewInitialized #5");
}
[Test]
@@ -503,21 +503,21 @@ namespace MonoTests.System.Data
randInt = rndm.Next () % rowCount;
dataView.Sort = "itemId";
drv = dataView [randInt];
AssertEquals ("test#01",randInt,dataView.Find (drv ["itemId"]));
Assert.AreEqual (randInt,dataView.Find (drv ["itemId"]), "test#01");
dataView.Sort = "itemId DESC";
drv = dataView [randInt];
AssertEquals ("test#02",randInt,dataView.Find (drv ["itemId"]));
Assert.AreEqual (randInt,dataView.Find (drv ["itemId"]), "test#02");
dataView.Sort = "itemId, itemName";
drv = dataView [randInt];
object [] keys = new object [2];
keys [0] = drv ["itemId"];
keys [1] = drv ["itemName"];
AssertEquals ("test#03",randInt,dataView.Find (keys));
Assert.AreEqual (randInt,dataView.Find (keys), "test#03");
dataView.Sort = "itemId";
AssertEquals ("test#04",-1,dataView.Find("no item"));
Assert.AreEqual (-1,dataView.Find("no item"), "test#04");
}
@@ -540,7 +540,7 @@ namespace MonoTests.System.Data
[Test]
public void ToStringTest ()
{
AssertEquals ("test#01","System.Data.DataView",dataView.ToString());
Assert.AreEqual ("System.Data.DataView",dataView.ToString(), "test#01");
}
[Test]
@@ -556,38 +556,38 @@ namespace MonoTests.System.Data
dataTable.Rows.Add(dr);
//PrintTableOrView(dataView, "ItemAdded");
AssertEquals ("test#01",ListChangedType.ItemAdded,listChangedArgs.ListChangedType);
Assert.AreEqual (ListChangedType.ItemAdded,listChangedArgs.ListChangedType, "test#01");
listChangedArgs = null;
dr ["itemId"] = "aitem 0";
// PrintTableOrView(dataView, "ItemChanged");
AssertEquals ("test#02",ListChangedType.ItemChanged,listChangedArgs.ListChangedType);
Assert.AreEqual (ListChangedType.ItemChanged,listChangedArgs.ListChangedType, "test#02");
listChangedArgs = null;
dr ["itemId"] = "zitem 0";
// PrintTableOrView(dataView, "ItemMoved");
AssertEquals ("test#03",ListChangedType.ItemMoved,listChangedArgs.ListChangedType);
Assert.AreEqual (ListChangedType.ItemMoved,listChangedArgs.ListChangedType, "test#03");
listChangedArgs = null;
dataTable.Rows.Remove (dr);
// PrintTableOrView(dataView, "ItemDeleted");
AssertEquals ("test#04",ListChangedType.ItemDeleted,listChangedArgs.ListChangedType);
Assert.AreEqual (ListChangedType.ItemDeleted,listChangedArgs.ListChangedType, "test#04");
listChangedArgs = null;
DataColumn dc5 = new DataColumn ("itemDesc");
dataTable.Columns.Add (dc5);
// PrintTableOrView(dataView, "PropertyDescriptorAdded");
AssertEquals ("test#05",ListChangedType.PropertyDescriptorAdded,listChangedArgs.ListChangedType);
Assert.AreEqual (ListChangedType.PropertyDescriptorAdded,listChangedArgs.ListChangedType, "test#05");
listChangedArgs = null;
dc5.ColumnName = "itemDescription";
// PrintTableOrView(dataView, "PropertyDescriptorChanged");
// AssertEquals ("test#06",ListChangedType.PropertyDescriptorChanged,listChangedArgs.ListChangedType);
// Assert.AreEqual ("test#06",ListChangedType.PropertyDescriptorChanged,listChangedArgs.ListChangedType);
listChangedArgs = null;
dataTable.Columns.Remove (dc5);
// PrintTableOrView(dataView, "PropertyDescriptorDeleted");
AssertEquals ("test#07",ListChangedType.PropertyDescriptorDeleted,listChangedArgs.ListChangedType);
Assert.AreEqual (ListChangedType.PropertyDescriptorDeleted,listChangedArgs.ListChangedType, "test#07");
}
[Test]
@@ -596,8 +596,8 @@ namespace MonoTests.System.Data
DataView TestView = new DataView (dataTable);
TestView.Sort = "itemId";
DataRowView[] Result = TestView.FindRows ("item 3");
Assertion.AssertEquals ("Dv #1", 1, Result.Length);
Assertion.AssertEquals ("Dv #2", "item 3", Result [0]["itemId"]);
Assert.AreEqual (1, Result.Length, "Dv #1");
Assert.AreEqual ("item 3", Result [0]["itemId"], "Dv #2");
}
[Test]
@@ -642,7 +642,7 @@ namespace MonoTests.System.Data
DataView TestView = new DataView (dataTable);
TestView.Delete (0);
DataRow r = TestView.Table.Rows [0];
Assertion.Assert ("Dv #1", !((string)r ["itemId"] == "item 1"));
Assert.IsTrue (!((string)r ["itemId"] == "item 1"), "Dv #1");
}
[Test]
@@ -685,13 +685,13 @@ namespace MonoTests.System.Data
DataView dataView = new DataView (dataset.Tables[0]);
AssertEquals ("before delete", 3, dataView.Count);
Assert.AreEqual (3, dataView.Count, "before delete");
dataView.AllowDelete = true;
// Deleting the first row
dataView.Delete (0);
AssertEquals ("before delete", 2, dataView.Count);
Assert.AreEqual (2, dataView.Count, "before delete");
}
[Test]
@@ -746,7 +746,7 @@ namespace MonoTests.System.Data
eventWriter.Write (" ------" + dv.Count);
DataRowView a3 = dv.AddNew ();
AssertEquals (reference, eventWriter.ToString ());
Assert.AreEqual (reference, eventWriter.ToString ());
}
[Test]
@@ -766,7 +766,7 @@ table was set.
dc2.ColumnName = "new_column_name";
AssertEquals (result.Replace ("\r\n", "\n"), eventWriter.ToString ().Replace ("\r\n", "\n"));
Assert.AreEqual (result.Replace ("\r\n", "\n"), eventWriter.ToString ().Replace ("\r\n", "\n"));
}
private void ListChanged (object o, ListChangedEventArgs e)
@@ -830,7 +830,7 @@ removed relation 2
ds.Relations.Remove (dr);
eventWriter.WriteLine ("removed relation 2");
AssertEquals (result.Replace ("\r\n", "\n"), eventWriter.ToString ().Replace ("\r\n", "\n"));
Assert.AreEqual (result.Replace ("\r\n", "\n"), eventWriter.ToString ().Replace ("\r\n", "\n"));
}
[Test]
@@ -942,7 +942,7 @@ table changed.
dv.Table = new DataTable ("table2");
eventWriter.WriteLine ("table changed.");
AssertEquals (result.Replace ("\r\n", "\n"), eventWriter.ToString ().Replace ("\r\n", "\n"));
Assert.AreEqual (result.Replace ("\r\n", "\n"), eventWriter.ToString ().Replace ("\r\n", "\n"));
}
[Test]
@@ -982,7 +982,7 @@ table was set.
dt.Columns.Add ("");
eventWriter.WriteLine (" add a column with an empty name.");
AssertEquals (result.Replace ("\r\n", "\n"), eventWriter.ToString ().Replace ("\r\n", "\n"));
Assert.AreEqual (result.Replace ("\r\n", "\n"), eventWriter.ToString ().Replace ("\r\n", "\n"));
GC.KeepAlive (dv);
}

View File

@@ -38,7 +38,7 @@ using System.Data;
namespace MonoTests.System.Data
{
[TestFixture]
public class ForeignKeyConstraintTest : Assertion
public class ForeignKeyConstraintTest
{
private DataSet _ds;
@@ -73,23 +73,23 @@ namespace MonoTests.System.Data
{
DataTable Table = _ds.Tables [0];
AssertEquals ("test#01", 0, Table.Constraints.Count);
Assert.AreEqual (0, Table.Constraints.Count, "test#01");
Table = _ds.Tables [1];
AssertEquals ("test#02", 0, Table.Constraints.Count);
Assert.AreEqual (0, Table.Constraints.Count, "test#02");
// ctor (string, DataColumn, DataColumn
ForeignKeyConstraint Constraint = new ForeignKeyConstraint ("test", _ds.Tables [0].Columns [2], _ds.Tables [1].Columns [0]);
Table = _ds.Tables [1];
Table.Constraints.Add (Constraint);
AssertEquals ("test#03", 1, Table.Constraints.Count);
AssertEquals ("test#04", "test", Table.Constraints [0].ConstraintName);
AssertEquals ("test#05", typeof (ForeignKeyConstraint), Table.Constraints [0].GetType ());
Assert.AreEqual (1, Table.Constraints.Count, "test#03");
Assert.AreEqual ("test", Table.Constraints [0].ConstraintName, "test#04");
Assert.AreEqual (typeof (ForeignKeyConstraint), Table.Constraints [0].GetType (), "test#05");
Table = _ds.Tables [0];
AssertEquals ("test#06", 1, Table.Constraints.Count);
AssertEquals ("test#07", "Constraint1", Table.Constraints [0].ConstraintName);
AssertEquals ("test#08", typeof (UniqueConstraint), Table.Constraints [0].GetType ());
Assert.AreEqual (1, Table.Constraints.Count, "test#06");
Assert.AreEqual ("Constraint1", Table.Constraints [0].ConstraintName, "test#07");
Assert.AreEqual (typeof (UniqueConstraint), Table.Constraints [0].GetType (), "test#08");
}
// Tests ctor (DataColumn, DataColumn)
@@ -98,23 +98,23 @@ namespace MonoTests.System.Data
{
DataTable Table = _ds.Tables [0];
AssertEquals ("test#01", 0, Table.Constraints.Count);
Assert.AreEqual (0, Table.Constraints.Count, "test#01");
Table = _ds.Tables [1];
AssertEquals ("test#02", 0, Table.Constraints.Count);
Assert.AreEqual (0, Table.Constraints.Count, "test#02");
// ctor (string, DataColumn, DataColumn
ForeignKeyConstraint Constraint = new ForeignKeyConstraint (_ds.Tables [0].Columns [2], _ds.Tables [1].Columns [0]);
Table = _ds.Tables [1];
Table.Constraints.Add (Constraint);
AssertEquals ("test#03", 1, Table.Constraints.Count);
AssertEquals ("test#04", "Constraint1", Table.Constraints [0].ConstraintName);
AssertEquals ("test#05", typeof (ForeignKeyConstraint), Table.Constraints [0].GetType ());
Assert.AreEqual (1, Table.Constraints.Count, "test#03");
Assert.AreEqual ("Constraint1", Table.Constraints [0].ConstraintName, "test#04");
Assert.AreEqual (typeof (ForeignKeyConstraint), Table.Constraints [0].GetType (), "test#05");
Table = _ds.Tables [0];
AssertEquals ("test#06", 1, Table.Constraints.Count);
AssertEquals ("test#07", "Constraint1", Table.Constraints [0].ConstraintName);
AssertEquals ("test#08", typeof (UniqueConstraint), Table.Constraints [0].GetType ());
Assert.AreEqual (1, Table.Constraints.Count, "test#06");
Assert.AreEqual ("Constraint1", Table.Constraints [0].ConstraintName, "test#07");
Assert.AreEqual (typeof (UniqueConstraint), Table.Constraints [0].GetType (), "test#08");
}
// Test ctor (DataColumn [], DataColumn [])
@@ -123,9 +123,9 @@ namespace MonoTests.System.Data
{
DataTable Table = _ds.Tables [0];
AssertEquals ("test#01", 0, Table.Constraints.Count);
Assert.AreEqual (0, Table.Constraints.Count, "test#01");
Table = _ds.Tables [1];
AssertEquals ("test#02", 0, Table.Constraints.Count);
Assert.AreEqual (0, Table.Constraints.Count, "test#02");
DataColumn [] Cols1 = new DataColumn [2];
Cols1 [0] = _ds.Tables [0].Columns [1];
@@ -139,14 +139,14 @@ namespace MonoTests.System.Data
Table = _ds.Tables [1];
Table.Constraints.Add (Constraint);
AssertEquals ("test#03", 1, Table.Constraints.Count);
AssertEquals ("test#04", "Constraint1", Table.Constraints [0].ConstraintName);
AssertEquals ("test#05", typeof (ForeignKeyConstraint), Table.Constraints [0].GetType ());
Assert.AreEqual (1, Table.Constraints.Count, "test#03");
Assert.AreEqual ("Constraint1", Table.Constraints [0].ConstraintName, "test#04");
Assert.AreEqual (typeof (ForeignKeyConstraint), Table.Constraints [0].GetType (), "test#05");
Table = _ds.Tables [0];
AssertEquals ("test#06", 1, Table.Constraints.Count);
AssertEquals ("test#07", "Constraint1", Table.Constraints [0].ConstraintName);
AssertEquals ("test#08", typeof (UniqueConstraint), Table.Constraints [0].GetType ());
Assert.AreEqual (1, Table.Constraints.Count, "test#06");
Assert.AreEqual ("Constraint1", Table.Constraints [0].ConstraintName, "test#07");
Assert.AreEqual (typeof (UniqueConstraint), Table.Constraints [0].GetType (), "test#08");
}
@@ -156,9 +156,9 @@ namespace MonoTests.System.Data
{
DataTable Table = _ds.Tables [0];
AssertEquals ("test#01", 0, Table.Constraints.Count);
Assert.AreEqual (0, Table.Constraints.Count, "test#01");
Table = _ds.Tables [1];
AssertEquals ("test#02", 0, Table.Constraints.Count);
Assert.AreEqual (0, Table.Constraints.Count, "test#02");
DataColumn [] Cols1 = new DataColumn [2];
Cols1 [0] = _ds.Tables [0].Columns [1];
@@ -172,14 +172,14 @@ namespace MonoTests.System.Data
Table = _ds.Tables [1];
Table.Constraints.Add (Constraint);
AssertEquals ("test#03", 1, Table.Constraints.Count);
AssertEquals ("test#04", "Test", Table.Constraints [0].ConstraintName);
AssertEquals ("test#05", typeof (ForeignKeyConstraint), Table.Constraints [0].GetType ());
Assert.AreEqual (1, Table.Constraints.Count, "test#03");
Assert.AreEqual ("Test", Table.Constraints [0].ConstraintName, "test#04");
Assert.AreEqual (typeof (ForeignKeyConstraint), Table.Constraints [0].GetType (), "test#05");
Table = _ds.Tables [0];
AssertEquals ("test#06", 1, Table.Constraints.Count);
AssertEquals ("test#07", "Constraint1", Table.Constraints [0].ConstraintName);
AssertEquals ("test#08", typeof (UniqueConstraint), Table.Constraints [0].GetType ());
Assert.AreEqual (1, Table.Constraints.Count, "test#06");
Assert.AreEqual ("Constraint1", Table.Constraints [0].ConstraintName, "test#07");
Assert.AreEqual (typeof (UniqueConstraint), Table.Constraints [0].GetType (), "test#08");
}
[Test]
@@ -211,7 +211,7 @@ namespace MonoTests.System.Data
ForeignKeyConstraint fkc = new ForeignKeyConstraint ("hello world", parentTableName, parentColumnNames, childColumnNames, AcceptRejectRule.Cascade, Rule.Cascade, Rule.Cascade); // Assert that the Constraint object does not belong to any table yet
try {
DataTable tmp = fkc.Table;
Fail ("When table is null, get_Table causes an InvalidOperationException.");
Assert.Fail ("When table is null, get_Table causes an InvalidOperationException.");
} catch (NullReferenceException) { // actually .NET throws this (bug)
} catch (InvalidOperationException) {
}
@@ -234,9 +234,12 @@ namespace MonoTests.System.Data
// OK - So AddRange() is the only way!
table2.Constraints.AddRange (constraints);
// After AddRange(), Check the properties of ForeignKeyConstraint object
Assertion.Assert("#A04", fkc.RelatedColumns [0].ColumnName.Equals ("col1")); Assertion.Assert("#A05", fkc.RelatedColumns [1].ColumnName.Equals ("col2")); Assertion.Assert("#A06", fkc.RelatedColumns [2].ColumnName.Equals ("col3")); Assertion.Assert("#A07", fkc.Columns [0].ColumnName.Equals ("col4"));
Assertion.Assert("#A08", fkc.Columns [1].ColumnName.Equals ("col5"));
Assertion.Assert("#A09", fkc.Columns [2].ColumnName.Equals ("col6"));
Assert.IsTrue(fkc.RelatedColumns [0].ColumnName.Equals ("col1"), "#A04");
Assert.IsTrue(fkc.RelatedColumns [1].ColumnName.Equals ("col2"), "#A05");
Assert.IsTrue(fkc.RelatedColumns [2].ColumnName.Equals ("col3"), "#A06");
Assert.IsTrue(fkc.Columns [0].ColumnName.Equals ("col4"), "#A07");
Assert.IsTrue(fkc.Columns [1].ColumnName.Equals ("col5"), "#A08");
Assert.IsTrue(fkc.Columns [2].ColumnName.Equals ("col6"), "#A09");
#endif
// Try to add columns with names which do not exist in the table
parentColumnNames [2] = "noColumn";
@@ -255,7 +258,7 @@ namespace MonoTests.System.Data
#if false // FIXME: Here this test crashes under MS.NET.
// Check whether the child table really contains the foreign key constraint named "hello world"
Assertion.Assert("#A11 ", table2.Constraints.Contains ("hello world"));
Assert.IsTrue(table2.Constraints.Contains ("hello world"), "#A11 ");
#endif
}
@@ -267,20 +270,20 @@ namespace MonoTests.System.Data
{
DataTable Table = _ds.Tables [0];
AssertEquals ("test#01", 0, Table.Constraints.Count);
Assert.AreEqual (0, Table.Constraints.Count, "test#01");
Table = _ds.Tables [1];
AssertEquals ("test#02", 0, Table.Constraints.Count);
Assert.AreEqual (0, Table.Constraints.Count, "test#02");
ForeignKeyConstraint Constraint = new ForeignKeyConstraint ("Test", _ds.Tables [0].Columns [0], _ds.Tables [0].Columns [2]);
Table = _ds.Tables [0];
Table.Constraints.Add (Constraint);
AssertEquals ("test#03", 2, Table.Constraints.Count);
AssertEquals ("test#04", "Constraint1", Table.Constraints [0].ConstraintName);
AssertEquals ("test#05", typeof (UniqueConstraint), Table.Constraints [0].GetType ());
AssertEquals ("test#04", "Test", Table.Constraints [1].ConstraintName);
AssertEquals ("test#05", typeof (ForeignKeyConstraint), Table.Constraints [1].GetType ());
Assert.AreEqual (2, Table.Constraints.Count, "test#03");
Assert.AreEqual ("Constraint1", Table.Constraints [0].ConstraintName, "test#04");
Assert.AreEqual (typeof (UniqueConstraint), Table.Constraints [0].GetType (), "test#05");
Assert.AreEqual ("Test", Table.Constraints [1].ConstraintName, "test#04");
Assert.AreEqual (typeof (ForeignKeyConstraint), Table.Constraints [1].GetType (), "test#05");
}
@@ -297,45 +300,45 @@ namespace MonoTests.System.Data
try
{
fkc = new ForeignKeyConstraint((DataColumn)null,(DataColumn)null);
Fail("Failed to throw ArgumentNullException.");
Assert.Fail("Assert.Failed to throw ArgumentNullException.");
}
catch (NullReferenceException) {}
catch (AssertionException exc) {throw exc;}
catch (Exception exc)
{
Fail("A1: Wrong Exception type. " + exc.ToString());
Assert.Fail("A1: Wrong Exception type. " + exc.ToString());
}
//zero length collection
try
{
fkc = new ForeignKeyConstraint(new DataColumn[]{},new DataColumn[]{});
Fail("B1: Failed to throw ArgumentException.");
Assert.Fail("B1: Assert.Failed to throw ArgumentException.");
}
catch (ArgumentException) {}
catch (AssertionException exc) {throw exc;}
catch (Exception exc)
{
Fail("A2: Wrong Exception type. " + exc.ToString());
Assert.Fail("A2: Wrong Exception type. " + exc.ToString());
}
//different datasets
try
{
fkc = new ForeignKeyConstraint(_ds.Tables[0].Columns[0], localTable.Columns[0]);
Fail("Failed to throw InvalidOperationException.");
Assert.Fail("Assert.Failed to throw InvalidOperationException.");
}
catch (InvalidOperationException) {}
catch (AssertionException exc) {throw exc;}
catch (Exception exc)
{
Fail("A3: Wrong Exception type. " + exc.ToString());
Assert.Fail("A3: Wrong Exception type. " + exc.ToString());
}
try
{
fkc = new ForeignKeyConstraint(_ds.Tables[0].Columns[0], localTable.Columns[1]);
Fail("Failed to throw InvalidConstraintException.");
Assert.Fail("Assert.Failed to throw InvalidConstraintException.");
}
// tables in different datasets
catch (InvalidOperationException) {}
@@ -345,7 +348,7 @@ namespace MonoTests.System.Data
try
{
fkc = new ForeignKeyConstraint(new DataColumn [] {_ds.Tables[0].Columns[0], _ds.Tables[0].Columns[1]}, new DataColumn [] {localTable.Columns[1], _ds.Tables[1].Columns [0]});
Fail("Failed to throw InvalidOperationException.");
Assert.Fail("Assert.Failed to throw InvalidOperationException.");
}
catch (InvalidConstraintException) {}
catch (AssertionException exc) {throw exc;}
@@ -362,13 +365,13 @@ namespace MonoTests.System.Data
try
{
fkc = new ForeignKeyConstraint(col, _ds.Tables[0].Columns[0]);
Fail("FTT1: Failed to throw ArgumentException.");
Assert.Fail("FTT1: Assert.Failed to throw ArgumentException.");
}
catch (ArgumentException) {}
catch (AssertionException exc) {throw exc;}
// catch (Exception exc)
// {
// Fail("WET1: Wrong Exception type. " + exc.ToString());
// Assert.Fail("WET1: Wrong Exception type. " + exc.ToString());
// }
//Columns must belong to the same table
@@ -382,13 +385,13 @@ namespace MonoTests.System.Data
_ds.Tables[0].Columns[1],
_ds.Tables[0].Columns[0]});
Fail("FTT2: Failed to throw InvalidConstraintException.");
Assert.Fail("FTT2: Assert.Failed to throw InvalidConstraintException.");
}
catch (InvalidConstraintException) {}
catch (AssertionException exc) {throw exc;}
catch (Exception exc)
{
Fail("WET2: Wrong Exception type. " + exc.ToString());
Assert.Fail("WET2: Wrong Exception type. " + exc.ToString());
}
@@ -403,13 +406,13 @@ namespace MonoTests.System.Data
fkc = new ForeignKeyConstraint(twoCol,
new DataColumn[] { _ds.Tables[0].Columns[0]});
Fail("FTT3: Failed to throw ArgumentException.");
Assert.Fail("FTT3: Assert.Failed to throw ArgumentException.");
}
catch (ArgumentException) {}
catch (AssertionException exc) {throw exc;}
catch (Exception exc)
{
Fail("WET3: Wrong Exception type. " + exc.ToString());
Assert.Fail("WET3: Wrong Exception type. " + exc.ToString());
}
//InvalidOperation: Parent and child are the same column.
@@ -418,13 +421,13 @@ namespace MonoTests.System.Data
fkc = new ForeignKeyConstraint( _ds.Tables[0].Columns[0],
_ds.Tables[0].Columns[0] );
Fail("FTT4: Failed to throw InvalidOperationException.");
Assert.Fail("FTT4: Assert.Failed to throw InvalidOperationException.");
}
catch (InvalidOperationException) {}
catch (AssertionException exc) {throw exc;}
catch (Exception exc)
{
Fail("WET4: Wrong Exception type. " + exc.ToString());
Assert.Fail("WET4: Wrong Exception type. " + exc.ToString());
}
}
@@ -446,14 +449,14 @@ namespace MonoTests.System.Data
ForeignKeyConstraint fkcDiff =
new ForeignKeyConstraint( tbl.Columns[1], tbl.Columns[2]);
Assert( "Equals failed. 1" , fkc.Equals(fkc2));
Assert( "Equals failed. 2" , fkc2.Equals(fkc));
Assert( "Equals failed. 3" , fkc.Equals(fkc));
Assert.IsTrue( fkc.Equals(fkc2) , "Equals Assert.IsTrue.Failed. 1");
Assert.IsTrue( fkc2.Equals(fkc) , "Equals Assert.IsTrue.Failed. 2");
Assert.IsTrue( fkc.Equals(fkc) , "Equals Assert.IsTrue.Failed. 3");
Assert( "Equals failed diff. 1" , fkc.Equals(fkcDiff) == false);
Assert.IsTrue( fkc.Equals(fkcDiff) == false , "Equals Assert.IsTrue.Failed diff. 1");
//Assert( "Hash Code Failed. 1", fkc.GetHashCode() == fkc2.GetHashCode() );
Assert( "Hash Code Failed. 2", fkc.GetHashCode() != fkcDiff.GetHashCode() );
//Assert.IsTrue( "Hash Code Assert.IsTrue.Failed. 1", fkc.GetHashCode() == fkc2.GetHashCode() );
Assert.IsTrue( fkc.GetHashCode() != fkcDiff.GetHashCode() , "Hash Code Assert.IsTrue.Failed. 2");
}
@@ -512,7 +515,7 @@ namespace MonoTests.System.Data
t2.Rows.Add (new object [] {10});
t1.Rows [0][0]=20;
Assert("#1", (int)t2.Rows [0][0] == 20);
Assert.IsTrue((int)t2.Rows [0][0] == 20, "#1");
}
[Test]

View File

@@ -38,7 +38,7 @@ using NUnit.Framework;
namespace MonoTests.System.Xml
{
[TestFixture]
public class XmlDataDocumentTest2 : Assertion
public class XmlDataDocumentTest2
{
string xml = "<NewDataSet><table><row><col1>1</col1><col2>2</col2></row></table></NewDataSet>";
@@ -53,8 +53,8 @@ namespace MonoTests.System.Xml
public void TestDefaultCtor ()
{
XmlDataDocument doc = new XmlDataDocument ();
AssertNotNull (doc.DataSet);
AssertEquals ("NewDataSet", doc.DataSet.DataSetName);
Assert.IsNotNull (doc.DataSet);
Assert.AreEqual ("NewDataSet", doc.DataSet.DataSetName);
}
[Test]
@@ -117,73 +117,73 @@ namespace MonoTests.System.Xml
ds.Relations.Add (rel);
XmlDataDocument doc = new XmlDataDocument (ds);
doc.LoadXml ("<set><tab1><col1>1</col1><col2/><child><ref>1</ref><val>aaa</val></child></tab1></set>");
AssertEquals (1, ds.Tables [0].Rows.Count);
AssertEquals (1, ds.Tables [1].Rows.Count);
Assert.AreEqual (1, ds.Tables [0].Rows.Count);
Assert.AreEqual (1, ds.Tables [1].Rows.Count);
// document element - no mapped row
XmlElement el = doc.DocumentElement;
AssertNull (doc.GetRowFromElement (el));
Assert.IsNull (doc.GetRowFromElement (el));
// tab1 element - has mapped row
el = el.FirstChild as XmlElement;
DataRow row = doc.GetRowFromElement (el);
AssertNotNull (row);
AssertEquals (DataRowState.Added, row.RowState);
Assert.IsNotNull (row);
Assert.AreEqual (DataRowState.Added, row.RowState);
// col1 - it is column. no mapped row
el = el.FirstChild as XmlElement;
row = doc.GetRowFromElement (el);
AssertNull (row);
Assert.IsNull (row);
// col2 - it is column. np mapped row
el = el.NextSibling as XmlElement;
row = doc.GetRowFromElement (el);
AssertNull (row);
Assert.IsNull (row);
// child - has mapped row
el = el.NextSibling as XmlElement;
row = doc.GetRowFromElement (el);
AssertNotNull (row);
AssertEquals (DataRowState.Added, row.RowState);
Assert.IsNotNull (row);
Assert.AreEqual (DataRowState.Added, row.RowState);
// created (detached) table 1 element (used later)
el = doc.CreateElement ("tab1");
row = doc.GetRowFromElement (el);
AssertEquals (DataRowState.Detached, row.RowState);
AssertEquals (1, dt.Rows.Count); // not added yet
Assert.AreEqual (DataRowState.Detached, row.RowState);
Assert.AreEqual (1, dt.Rows.Count); // not added yet
// adding a node before setting EnforceConstraints
// raises an error
try {
doc.DocumentElement.AppendChild (el);
Fail ("Invalid Operation should occur; EnforceConstraints prevents addition.");
Assert.Fail ("Invalid Operation should occur; EnforceConstraints prevents addition.");
} catch (InvalidOperationException) {
}
// try again...
ds.EnforceConstraints = false;
AssertEquals (1, dt.Rows.Count); // not added yet
Assert.AreEqual (1, dt.Rows.Count); // not added yet
doc.DocumentElement.AppendChild (el);
AssertEquals (2, dt.Rows.Count); // added
Assert.AreEqual (2, dt.Rows.Count); // added
row = doc.GetRowFromElement (el);
AssertEquals (DataRowState.Added, row.RowState); // changed
Assert.AreEqual (DataRowState.Added, row.RowState); // changed
// Irrelevant element
XmlElement el2 = doc.CreateElement ("hoge");
row = doc.GetRowFromElement (el2);
AssertNull (row);
Assert.IsNull (row);
// created table 2 element (used later)
el = doc.CreateElement ("child");
row = doc.GetRowFromElement (el);
AssertEquals (DataRowState.Detached, row.RowState);
Assert.AreEqual (DataRowState.Detached, row.RowState);
// Adding it to irrelevant element performs no row state change.
AssertEquals (1, dt2.Rows.Count); // not added yet
Assert.AreEqual (1, dt2.Rows.Count); // not added yet
el2.AppendChild (el);
AssertEquals (1, dt2.Rows.Count); // still not added
Assert.AreEqual (1, dt2.Rows.Count); // still not added
row = doc.GetRowFromElement (el);
AssertEquals (DataRowState.Detached, row.RowState); // still detached here
Assert.AreEqual (DataRowState.Detached, row.RowState); // still detached here
}
// bug #54505
@@ -244,8 +244,8 @@ namespace MonoTests.System.Xml
StringReader sr = new StringReader (sw.ToString());
doc1.Load (sr);
AssertEquals ("#1", 1, ds1.Tables [0].Rows.Count);
AssertEquals ("#2", 1, ds1.Tables [0].Rows [0][0]);
Assert.AreEqual (1, ds1.Tables [0].Rows.Count, "#1");
Assert.AreEqual (1, ds1.Tables [0].Rows [0][0], "#2");
}
[Test]
@@ -267,8 +267,8 @@ namespace MonoTests.System.Xml
StringReader sr = new StringReader (sw.ToString());
doc1.Load (sr);
AssertEquals ("#1", 1, ds1.Tables [0].Rows [0][0]);
AssertEquals ("#2", true, ds1.Tables [0].Rows [0].IsNull (1));
Assert.AreEqual (1, ds1.Tables [0].Rows [0][0], "#1");
Assert.AreEqual (true, ds1.Tables [0].Rows [0].IsNull (1), "#2");
}
[Test]
@@ -301,9 +301,9 @@ namespace MonoTests.System.Xml
StringReader sreader = new StringReader (swriter.ToString ());
DataSet ds1 = ds.Clone ();
XmlDataDocument doc1 = new XmlDataDocument (ds1);
AssertEquals ("#2" , 0, ds1.Tables [0].Rows.Count);
Assert.AreEqual (0 , ds1.Tables [0].Rows.Count, "#2");
doc1.Load (sreader);
AssertEquals ("#3" , 3, ds1.Tables [0].Rows.Count);
Assert.AreEqual (3 , ds1.Tables [0].Rows.Count, "#3");
}
}
}