public void DatabaseTable_IsExists(string tableName) { using (var connection = ConnectionUtil.CreateConnection()) { var sql = $"SELECT COUNT(*) FROM `sqlite_master` WHERE `type`='table' AND `name` = '{tableName}'"; var result = connection.QueryFirstOrDefault <int>(sql); Assert.Equal(1, result); } }
private void CreateServiceCollection() { var services = new ServiceCollection(); services.AddOptions(); services.AddLogging(); ConnectionString = ConnectionUtil.GetConnectionString(); services.AddOptions <CapOptions>(); services.Configure <SqliteOptions>(x => { x.ConnectionString = ConnectionString; }); services.AddSingleton <SqliteDataStorage>(); services.AddSingleton <IStorageInitializer, SqliteStorageInitializer>(); _services = services; }
public void Database_IsExists() { var databasePath = ConnectionUtil.GetDatabasePath(); Assert.True(File.Exists(databasePath)); }