You've already forked linux-packaging-mono
Imported Upstream version 6.4.0.137
Former-commit-id: 943baa9f16a098c33e129777827f3a9d20da00d6
This commit is contained in:
parent
e9207cf623
commit
ef583813eb
@@ -41,45 +41,104 @@ using MonoTests.Helpers;
|
||||
|
||||
namespace MonoTests.Mono.Data.Sqlite
|
||||
{
|
||||
[TestFixture]
|
||||
public class SqliteDataReaderTest
|
||||
{
|
||||
readonly static string _uri = TestResourceHelper.GetFullPathOfResource("Test/test.db");
|
||||
readonly static string _connectionString = "URI=file://" + _uri + ", version=3";
|
||||
SqliteConnection _conn = new SqliteConnection ();
|
||||
[TestFixture]
|
||||
public class SqliteDataReaderTest
|
||||
{
|
||||
readonly static string _uri = TestResourceHelper.GetFullPathOfResource("Test/test.db");
|
||||
readonly static string _connectionString = "URI=file://" + _uri + ", version=3";
|
||||
SqliteConnection _conn = new SqliteConnection ();
|
||||
|
||||
[TestFixtureSetUp]
|
||||
public void FixtureSetUp ()
|
||||
{
|
||||
if (! File.Exists (_uri) || new FileInfo (_uri).Length == 0) {
|
||||
// ignore all tests
|
||||
Assert.Ignore ("#000 ignoring all fixtures. No database present");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Test]
|
||||
[Category ("NotWorking")]
|
||||
public void GetSchemaTableTest ()
|
||||
{
|
||||
_conn.ConnectionString = _connectionString;
|
||||
SqliteDataReader reader = null;
|
||||
using (_conn) {
|
||||
_conn.Open ();
|
||||
SqliteCommand cmd = (SqliteCommand) _conn.CreateCommand ();
|
||||
cmd.CommandText = "select * from test";
|
||||
reader = cmd.ExecuteReader ();
|
||||
try {
|
||||
DataTable dt = reader.GetSchemaTable ();
|
||||
Assert.IsNotNull (dt, "#GS1 should return valid table");
|
||||
Assert.IsTrue (dt.Rows.Count > 0, "#GS2 should return with rows ;-)");
|
||||
} finally {
|
||||
if (reader != null && !reader.IsClosed)
|
||||
reader.Close ();
|
||||
_conn.Close ();
|
||||
}
|
||||
}
|
||||
}
|
||||
[TestFixtureSetUp]
|
||||
public void FixtureSetUp ()
|
||||
{
|
||||
if (! File.Exists (_uri) || new FileInfo (_uri).Length == 0) {
|
||||
// ignore all tests
|
||||
Assert.Ignore ("#000 ignoring all fixtures. No database present");
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void EmptyStatementThrowsAgrumentException ()
|
||||
{
|
||||
_conn.ConnectionString = _connectionString;
|
||||
SqliteDataReader reader = null;
|
||||
using (_conn) {
|
||||
_conn.Open ();
|
||||
SqliteCommand cmd = (SqliteCommand) _conn.CreateCommand ();
|
||||
cmd.CommandText = string.Empty;
|
||||
try {
|
||||
reader = cmd.ExecuteReader ();
|
||||
Assert.Fail ();
|
||||
} catch (ArgumentException ex){
|
||||
// expected this one
|
||||
} catch (Exception ex) {
|
||||
Assert.Fail ();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void NullStatementThrowsAgrumentException ()
|
||||
{
|
||||
_conn.ConnectionString = _connectionString;
|
||||
SqliteDataReader reader = null;
|
||||
using (_conn) {
|
||||
_conn.Open ();
|
||||
SqliteCommand cmd = (SqliteCommand) _conn.CreateCommand ();
|
||||
cmd.CommandText = null;
|
||||
try {
|
||||
reader = cmd.ExecuteReader ();
|
||||
Assert.Fail ();
|
||||
} catch (ArgumentException ex){
|
||||
// expected this one
|
||||
} catch (Exception ex) {
|
||||
Assert.Fail ();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void WhitespaceOnlyStatementThrowsAgrumentException ()
|
||||
{
|
||||
_conn.ConnectionString = _connectionString;
|
||||
SqliteDataReader reader = null;
|
||||
using (_conn) {
|
||||
_conn.Open ();
|
||||
SqliteCommand cmd = (SqliteCommand) _conn.CreateCommand ();
|
||||
cmd.CommandText = " ";
|
||||
try {
|
||||
reader = cmd.ExecuteReader ();
|
||||
Assert.Fail ();
|
||||
} catch (ArgumentException ex){
|
||||
// expected this one
|
||||
} catch (Exception ex) {
|
||||
Assert.Fail ();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
[Category ("NotWorking")]
|
||||
public void GetSchemaTableTest ()
|
||||
{
|
||||
_conn.ConnectionString = _connectionString;
|
||||
SqliteDataReader reader = null;
|
||||
using (_conn) {
|
||||
_conn.Open ();
|
||||
SqliteCommand cmd = (SqliteCommand) _conn.CreateCommand ();
|
||||
cmd.CommandText = "select * from test";
|
||||
reader = cmd.ExecuteReader ();
|
||||
try {
|
||||
DataTable dt = reader.GetSchemaTable ();
|
||||
Assert.IsNotNull (dt, "#GS1 should return valid table");
|
||||
Assert.IsTrue (dt.Rows.Count > 0, "#GS2 should return with rows ;-)");
|
||||
} finally {
|
||||
if (reader != null && !reader.IsClosed)
|
||||
reader.Close ();
|
||||
_conn.Close ();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TypeOfNullInResultTest ()
|
||||
@@ -301,5 +360,5 @@ namespace MonoTests.Mono.Data.Sqlite
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user