Skip to content

Commit

Permalink
2008-07-15 Marek Habersack <mhabersack@novell.com>
Browse files Browse the repository at this point in the history
	* SqliteParameterUnitTests.cs: adjust the blob value comparison
	test for the 2.0 profile.

	* SqliteCommandUnitTests.cs, SqliteExceptionUnitTests.cs: change
	the expected exception type for the 2.0 profile.

	* SqliteConnectionTest.cs: add tests for the 2.0 profile, disable
	tests which are incorrect for this profile.

svn path=/trunk/mcs/; revision=107936
  • Loading branch information
grendello committed Jul 15, 2008
1 parent a1d5c98 commit 5ab207c
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 3 deletions.
11 changes: 11 additions & 0 deletions mcs/class/Mono.Data.Sqlite/Test/ChangeLog
@@ -1,3 +1,14 @@
2008-07-15 Marek Habersack <mhabersack@novell.com>

* SqliteParameterUnitTests.cs: adjust the blob value comparison
test for the 2.0 profile.

* SqliteCommandUnitTests.cs, SqliteExceptionUnitTests.cs: change
the expected exception type for the 2.0 profile.

* SqliteConnectionTest.cs: add tests for the 2.0 profile, disable
tests which are incorrect for this profile.

2007-01-16 Nagappan A <anagappan@novell.com>

* SqliteDataAdapterUnitTests.cs (GetSchemaTable): Type casted to
Expand Down
4 changes: 4 additions & 0 deletions mcs/class/Mono.Data.Sqlite/Test/SqliteCommandUnitTests.cs
Expand Up @@ -164,7 +164,11 @@ public void InsertWithTransaction()
}

[Test]
#if NET_2_0
[ExpectedException(typeof(SqliteException))]
#else
[ExpectedException(typeof(SqliteSyntaxException))]
#endif
public void InsertWithFailingTransaction()
{
_conn.Open();
Expand Down
26 changes: 24 additions & 2 deletions mcs/class/Mono.Data.Sqlite/Test/SqliteConnectionTest.cs
Expand Up @@ -43,7 +43,28 @@ public class SqliteConnectionTest
readonly static string _connectionString = "URI=file://" + _uri + ", version=3";
SqliteConnection _conn = new SqliteConnection ();


#if NET_2_0
[Test]
[ExpectedException (typeof (ArgumentNullException))]
public void ConnectionStringTest_Null ()
{
_conn.ConnectionString = null;
}

[Test]
[ExpectedException (typeof (InvalidOperationException))]
public void ConnectionStringTest_MustBeClosed ()
{
_conn.ConnectionString = _connectionString;
try {
_conn.Open ();
_conn.ConnectionString = _connectionString;
} finally {
_conn.Close ();
}
}

#else
[Test]
[ExpectedException (typeof (InvalidOperationException))]
public void ConnectionStringTest_Empty ()
Expand All @@ -58,13 +79,14 @@ public void ConnectionStringTest_NoURI ()
_conn.ConnectionString = "version=3";
}

// In 2.0 _conn.Database always returns "main"
[Test]
public void ConnectionStringTest_IgnoreSpacesAndTrim ()
{
_conn.ConnectionString = "URI=file://xyz , ,,, ,, version=3";
Assert.AreEqual ("xyz", _conn.Database, "#1 file path is wrong");
}

#endif
// behavior has changed, I guess
//[Test]
[Ignore ("opening a connection should not create db! though, leave for now")]
Expand Down
4 changes: 4 additions & 0 deletions mcs/class/Mono.Data.Sqlite/Test/SqliteExceptionUnitTests.cs
Expand Up @@ -24,7 +24,11 @@ public SqliteExceptionUnitTests()
}

[Test]
#if NET_2_0
[ExpectedException(typeof(SqliteException))]
#else
[ExpectedException(typeof(SqliteSyntaxException))]
#endif
public void WrongSyntax()
{
SqliteCommand insertCmd = new SqliteCommand("INSERT INTO t1 VALUES (,')",_conn);
Expand Down
8 changes: 7 additions & 1 deletion mcs/class/Mono.Data.Sqlite/Test/SqliteParameterUnitTests.cs
Expand Up @@ -74,7 +74,13 @@ public void InsertRandomValuesWithParameter()
Assert.AreEqual(reader["t"], textP.Value);
Assert.AreEqual(reader["f"], floatP.Value);
Assert.AreEqual(reader["i"], integerP.Value);
Assert.AreEqual(reader["b"], blobP.Value);

object compareValue;
if (blobP.Value is byte[])
compareValue = System.Text.Encoding.UTF8.GetString ((byte[])blobP.Value);
else
compareValue = blobP.Value;
Assert.AreEqual(reader["b"], compareValue);
Assert.AreEqual(reader.Read(), false);
}
}
Expand Down

0 comments on commit 5ab207c

Please sign in to comment.