You've already forked linux-packaging-mono
Imported Upstream version 5.8.0.88
Former-commit-id: 4b7216ffda08448e562271ce733688e761120fc5
This commit is contained in:
parent
7d05485754
commit
6123a772ed
@@ -20,13 +20,24 @@ namespace MonoTests.Mono.Data.Sqlite {
|
||||
|
||||
[TestFixture]
|
||||
public class SqliteiOS82BugTests {
|
||||
readonly static string dbPath = Path.Combine (Environment.GetFolderPath (Environment.SpecialFolder.Personal), "adodemo.db3");
|
||||
readonly static string connectionString = "Data Source=" + dbPath;
|
||||
static SqliteConnection cnn = new SqliteConnection (connectionString);
|
||||
string dbPath;
|
||||
string connectionString;
|
||||
SqliteConnection cnn;
|
||||
|
||||
[SetUp]
|
||||
public void Create()
|
||||
{
|
||||
dbPath = Path.GetTempFileName ();
|
||||
|
||||
// We want to start with a fresh db for each full run
|
||||
// The database is created on the first open()
|
||||
// but TempFile does create a file
|
||||
if (File.Exists (dbPath))
|
||||
File.Delete (dbPath);
|
||||
|
||||
connectionString = "Data Source=" + dbPath;
|
||||
cnn = new SqliteConnection (connectionString);
|
||||
|
||||
try {
|
||||
if(File.Exists(dbPath)) {
|
||||
cnn.Dispose();
|
||||
@@ -56,6 +67,13 @@ namespace MonoTests.Mono.Data.Sqlite {
|
||||
}
|
||||
}
|
||||
|
||||
[TearDown]
|
||||
public void TearDown ()
|
||||
{
|
||||
if (File.Exists (dbPath))
|
||||
File.Delete (dbPath);
|
||||
}
|
||||
|
||||
// Ref: https://bugzilla.xamarin.com/show_bug.cgi?id=27864
|
||||
// As of iOS 8.2 Apple updated Sqlite and broke queries that used to work pre iOS 8.2 like the select command in this test
|
||||
// The pruppose of this test is to know when apple fixes this. Expected test behaivour is as follows.
|
||||
|
||||
@@ -16,9 +16,9 @@ namespace MonoTests.Mono.Data.Sqlite
|
||||
[TestFixture]
|
||||
public class SqliteCommandUnitTests
|
||||
{
|
||||
readonly static string _uri = Path.Combine (Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "SqliteTest.db");
|
||||
readonly static string _connectionString = "URI=file://" + _uri + ", version=3";
|
||||
static SqliteConnection _conn = new SqliteConnection (_connectionString);
|
||||
string _uri;
|
||||
string _connectionString;
|
||||
SqliteConnection _conn;
|
||||
readonly static string stringvalue = "my keyboard is better than yours : äöüß";
|
||||
|
||||
public SqliteCommandUnitTests()
|
||||
@@ -28,6 +28,10 @@ namespace MonoTests.Mono.Data.Sqlite
|
||||
[SetUp]
|
||||
public void Create()
|
||||
{
|
||||
_uri = Path.GetTempFileName ();
|
||||
_connectionString = "URI=file://" + _uri + ", version=3";
|
||||
_conn = new SqliteConnection (_connectionString);
|
||||
|
||||
try
|
||||
{
|
||||
if(File.Exists(_uri))
|
||||
@@ -65,6 +69,13 @@ namespace MonoTests.Mono.Data.Sqlite
|
||||
}
|
||||
}
|
||||
|
||||
[TearDown]
|
||||
public void TearDown ()
|
||||
{
|
||||
if (File.Exists (_uri))
|
||||
File.Delete (_uri);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Select()
|
||||
{
|
||||
@@ -195,4 +206,4 @@ namespace MonoTests.Mono.Data.Sqlite
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,13 +37,33 @@ using NUnit.Framework;
|
||||
|
||||
namespace MonoTests.Mono.Data.Sqlite
|
||||
{
|
||||
[TestFixture]
|
||||
public class SqliteConnectionTest
|
||||
{
|
||||
readonly static string _uri = Path.Combine (Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "test.db");
|
||||
readonly static string _connectionString = "URI=file://" + _uri + ", version=3";
|
||||
SqliteConnection _conn = new SqliteConnection ();
|
||||
[TestFixture]
|
||||
public class SqliteConnectionTest
|
||||
{
|
||||
string _dataFolder;
|
||||
string _uri;
|
||||
string _connectionString;
|
||||
SqliteConnection _conn;
|
||||
|
||||
[SetUp]
|
||||
public void SetUp ()
|
||||
{
|
||||
_dataFolder = Path.GetTempFileName ();
|
||||
if (File.Exists (_dataFolder))
|
||||
File.Delete (_dataFolder);
|
||||
Directory.CreateDirectory (_dataFolder);
|
||||
|
||||
_uri = Path.Combine (_dataFolder, "test.db");
|
||||
_connectionString = "URI=file://" + _uri + ", version=3";
|
||||
_conn = new SqliteConnection ();
|
||||
}
|
||||
|
||||
[TearDown]
|
||||
public void TeatDown ()
|
||||
{
|
||||
if (Directory.Exists (_dataFolder))
|
||||
Directory.Delete (_dataFolder, true);
|
||||
}
|
||||
[Test]
|
||||
public void ReleaseDatabaseFileHandles ()
|
||||
{
|
||||
@@ -64,49 +84,49 @@ namespace MonoTests.Mono.Data.Sqlite
|
||||
File.Delete (_uri);
|
||||
}
|
||||
|
||||
[Test]
|
||||
[ExpectedException (typeof (ArgumentNullException))]
|
||||
public void ConnectionStringTest_Null ()
|
||||
{
|
||||
_conn.ConnectionString = null;
|
||||
}
|
||||
[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 ();
|
||||
}
|
||||
}
|
||||
[Test]
|
||||
[ExpectedException (typeof (InvalidOperationException))]
|
||||
public void ConnectionStringTest_MustBeClosed ()
|
||||
{
|
||||
_conn.ConnectionString = _connectionString;
|
||||
try {
|
||||
_conn.Open ();
|
||||
_conn.ConnectionString = _connectionString;
|
||||
} finally {
|
||||
_conn.Close ();
|
||||
}
|
||||
}
|
||||
|
||||
// behavior has changed, I guess
|
||||
//[Test]
|
||||
[Ignore ("opening a connection should not create db! though, leave for now")]
|
||||
public void OpenTest ()
|
||||
{
|
||||
try {
|
||||
_conn.ConnectionString = _connectionString;
|
||||
_conn.Open ();
|
||||
Assert.AreEqual (ConnectionState.Open, _conn.State, "#1 not opened");
|
||||
_conn.Close ();
|
||||
// behavior has changed, I guess
|
||||
//[Test]
|
||||
[Ignore ("opening a connection should not create db! though, leave for now")]
|
||||
public void OpenTest ()
|
||||
{
|
||||
try {
|
||||
_conn.ConnectionString = _connectionString;
|
||||
_conn.Open ();
|
||||
Assert.AreEqual (ConnectionState.Open, _conn.State, "#1 not opened");
|
||||
_conn.Close ();
|
||||
|
||||
// negative test: try opening a non-existent file
|
||||
_conn.ConnectionString = "URI=file://abcdefgh.db, version=3";
|
||||
try {
|
||||
_conn.Open ();
|
||||
Assert.Fail ("#1 should have failed on opening a non-existent db");
|
||||
} catch (ArgumentException e) {Console.WriteLine (e);}
|
||||
|
||||
} finally {
|
||||
if (_conn != null && _conn.State != ConnectionState.Closed)
|
||||
_conn.Close ();
|
||||
}
|
||||
}
|
||||
// negative test: try opening a non-existent file
|
||||
_conn.ConnectionString = "URI=file://abcdefgh.db, version=3";
|
||||
try {
|
||||
_conn.Open ();
|
||||
Assert.Fail ("#1 should have failed on opening a non-existent db");
|
||||
} catch (ArgumentException e) {Console.WriteLine (e);}
|
||||
|
||||
} finally {
|
||||
if (_conn != null && _conn.State != ConnectionState.Closed)
|
||||
_conn.Close ();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,11 +15,26 @@ namespace MonoTests.Mono.Data.Sqlite
|
||||
[TestFixture]
|
||||
public class SqliteDataAdapterUnitTests
|
||||
{
|
||||
readonly static string _uri = "SqliteTest.db";
|
||||
readonly static string _connectionString = "URI=file://" + _uri + ", version=3";
|
||||
static SqliteConnection _conn = new SqliteConnection (_connectionString);
|
||||
string _uri;
|
||||
string _connectionString;
|
||||
SqliteConnection _conn;
|
||||
|
||||
static SqliteDataAdapter PrepareDataAdapter()
|
||||
[SetUp]
|
||||
public void SetUp ()
|
||||
{
|
||||
_uri = Path.GetTempFileName ();
|
||||
_connectionString = "URI=file://" + _uri + ", version=3";
|
||||
_conn = new SqliteConnection (_connectionString);
|
||||
}
|
||||
|
||||
[TearDown]
|
||||
public void TearDown ()
|
||||
{
|
||||
if (File.Exists (_uri))
|
||||
File.Delete (_uri);
|
||||
}
|
||||
|
||||
SqliteDataAdapter PrepareDataAdapter()
|
||||
{
|
||||
SqliteCommand select = new SqliteCommand("SELECT t, f, i, b FROM t1",_conn);
|
||||
SqliteCommand update = new SqliteCommand("UPDATE t1 SET t = :textP, f = :floatP, i = :integerP, n=:blobP WHERE t = :textP ");
|
||||
|
||||
@@ -15,12 +15,23 @@ namespace MonoTests.Mono.Data.Sqlite
|
||||
[TestFixture]
|
||||
public class SqliteExceptionUnitTests
|
||||
{
|
||||
readonly static string _uri = "SqliteTest.db";
|
||||
readonly static string _connectionString = "URI=file://" + _uri + ", version=3";
|
||||
static SqliteConnection _conn = new SqliteConnection (_connectionString);
|
||||
static string _uri;
|
||||
static string _connectionString;
|
||||
SqliteConnection _conn;
|
||||
|
||||
public SqliteExceptionUnitTests()
|
||||
[SetUp]
|
||||
public void SetUp ()
|
||||
{
|
||||
_uri = Path.GetTempFileName ();
|
||||
_connectionString = "URI=file://" + _uri + ", version=3";
|
||||
_conn = new SqliteConnection (_connectionString);
|
||||
}
|
||||
|
||||
[TearDown]
|
||||
public void TearDown ()
|
||||
{
|
||||
if (File.Exists (_uri))
|
||||
File.Delete (_uri);
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
||||
@@ -20,7 +20,20 @@ namespace MonoTests.Mono.Data.Sqlite
|
||||
[TestFixture]
|
||||
public class SqliteFunctionTest
|
||||
{
|
||||
readonly static string uri = Path.Combine (Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "test.db");
|
||||
string uri;
|
||||
|
||||
[SetUp]
|
||||
public void SetUp ()
|
||||
{
|
||||
uri = Path.GetTempFileName ();
|
||||
}
|
||||
|
||||
[TearDown]
|
||||
public void TearDown ()
|
||||
{
|
||||
if (File.Exists (uri))
|
||||
File.Delete (uri);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void CollationTest()
|
||||
|
||||
@@ -15,14 +15,24 @@ namespace MonoTests.Mono.Data.Sqlite
|
||||
[TestFixture]
|
||||
public class SqliteParameterUnitTests
|
||||
{
|
||||
readonly static string _uri = "SqliteTest.db";
|
||||
readonly static string _connectionString = "URI=file://" + _uri + ", version=3";
|
||||
static SqliteConnection _conn = new SqliteConnection (_connectionString);
|
||||
string _uri;
|
||||
string _connectionString;
|
||||
SqliteConnection _conn;
|
||||
|
||||
public SqliteParameterUnitTests()
|
||||
[SetUp]
|
||||
public void SetUp ()
|
||||
{
|
||||
_uri = Path.GetTempFileName ();
|
||||
_connectionString = "URI=file://" + _uri + ", version=3";
|
||||
_conn = new SqliteConnection (_connectionString);
|
||||
}
|
||||
|
||||
[TearDown]
|
||||
public void TearDown ()
|
||||
{
|
||||
if (File.Exists (_uri))
|
||||
File.Delete (_uri);
|
||||
}
|
||||
|
||||
[Test]
|
||||
[Category ("NotWorking")]
|
||||
// fails randomly :)
|
||||
|
||||
@@ -43,24 +43,16 @@ namespace MonoTests.Mono.Data.Sqlite
|
||||
[SetUp]
|
||||
public void Setup ()
|
||||
{
|
||||
var dataFolder = Path.Combine (Environment.GetFolderPath (Environment.SpecialFolder.Personal), "SqlTest");
|
||||
|
||||
_databasePath = Path.Combine (dataFolder, "database.db");
|
||||
|
||||
if (!Directory.Exists (dataFolder)) {
|
||||
Directory.CreateDirectory (dataFolder);
|
||||
}
|
||||
|
||||
_databasePath = Path.GetTempFileName ();
|
||||
File.Delete (_databasePath);
|
||||
}
|
||||
|
||||
[TearDown]
|
||||
public void TearDown ()
|
||||
{
|
||||
try {
|
||||
if (File.Exists (_databasePath))
|
||||
File.Delete (_databasePath);
|
||||
} catch {
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
||||
Reference in New Issue
Block a user