Currently I am working on unit tests for a Xamarin MvvmCross Application using SQLite.Net-PCL 3.1.1. The unit test project is a normal .NET project.
So now I am mocking the MvxSqliteConnectionFactoryBase
public class MockMvxSqliteConnectionFactoryBase : MvxSqliteConnectionFactoryBase
{
#region implemented abstract members of MvxSqliteConnectionFactoryBase
public override string GetPlattformDatabasePath(string databaseName)
{
return "Data Source=:memory:";
}
public override ISQLitePlatform GetCurrentPlatform()
{
return new SQLite.Net.Platform.Generic.SQLitePlatformGeneric();
}
public override ISQLitePlatform GetCurrentPlatform(string key)
{
return new SQLite.Net.Platform.Generic.SQLitePlatformGeneric();
}
#endregion
}
But the database is not created in memory rather than in the bin
folder of the project.
I tried to initialize SQLiteConnection
like this example but there is not a constructor that accepts only one string.
MvxSqliteConnectionFactoryBase
class. It may be changing the connection string. – BoschData Source=
really be part of the path? – Microstructure