private void InitializeDatabase()
        {
            var sqliteConn   = ConnectionUtil.GetConnectionString();
            var databaseName = ConnectionUtil.GetDatabaseName();

            if (!File.Exists(databaseName))
            {
                using (var connection = ConnectionUtil.CreateConnection(sqliteConn))
                {
                    connection.Open();
                    var storage = _serviceProvider.GetService <IStorageInitializer>();
                    var token   = new CancellationTokenSource().Token;
                    storage.InitializeAsync(token).GetAwaiter().GetResult();
                    connection.Close();
                }
            }
        }
        protected DatabaseTestHost()
        {
            _services = new ServiceCollection();
            _services.AddOptions();
            _services.AddLogging();
            _services.AddCap(options =>
            {
                options.UseSqlite(ConnectionUtil.GetConnectionString());
            });

            _serviceProvider = _services.BuildServiceProvider();

            Logger = new Mock <ILogger <SqliteDataStorage> >().Object;

            CapOptions    = GetRequiredService <IOptions <CapOptions> >();
            SqliteOptions = GetRequiredService <IOptions <SqliteOptions> >();

            InitializeDatabase();
        }
 public SqliteStorageTest()
 {
     _dbConnectionString = ConnectionUtil.GetConnectionString();
 }