public void Init() { _cache = Isolate.Fake.Instance<IConnectionCache>(); _connection = Isolate.Fake.Instance<IDbConnection>(); Isolate.WhenCalled(() => _cache.SetConnection(_connection)).IgnoreCall(); Isolate.WhenCalled(() => _cache.GetConnection()).WillReturn(_connection); InitCache(); _config = new SqLiteConfig(); }
public void NotSetANewConnectionWhenConnectionCacheIsEmptyAndNotInMemoryDatabase() { InitCache(); var conn = Isolate.Fake.Instance<SQLiteConnection>(); Isolate.Swap.NextInstance<SQLiteConnection>().With(conn); _config = new SqLiteConfig("Not an in memory connection string"); _config.GetConnection(); Isolate.Verify.WasNotCalled(() => _cache.SetConnection(_connection)); }
public void AddInMemorySqLiteEnvironment <TMap>(string name) { if (_configurations.Keys.Contains(name)) { return; } var dbConfig = new SqLiteConfig(); var config = GetFluentConfig <TMap>(); AddConfiguration(name, config, dbConfig); }
public void CreateNewSqlLiteConfig() { var config = new SqLiteConfig(); }
public void SetANewConnectionWhenConnectionCacheIsEmptyAndInMemoryDatabase() { Isolate.CleanUp(); _cache = Isolate.Fake.Instance<IConnectionCache>(); _connection = Isolate.Fake.Instance<IDbConnection>(); Isolate.WhenCalled(() => _cache.HasNoConnection).WillReturn(true); Isolate.WhenCalled(() => _cache.GetConnection()).WillReturn(_connection); Isolate.WhenCalled(() => _cache.SetConnection(_connection)).IgnoreCall(); Isolate.WhenCalled(() => _connection.ConnectionString).WillReturn(SqLiteConfig.InMemoryDbConnectionString); InitCache(); _config = new SqLiteConfig(); _config.GetConnection(); Isolate.Verify.WasCalledWithAnyArguments(() => _cache.SetConnection(_connection)); }