示例#1
0
 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);
     }
 }
示例#2
0
        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;
        }
示例#3
0
        public void Database_IsExists()
        {
            var databasePath = ConnectionUtil.GetDatabasePath();

            Assert.True(File.Exists(databasePath));
        }