Ejemplo n.º 1
0
        public async Task FileConnectionTestAsync()
        {
            var    guid   = System.Guid.NewGuid().ToString();
            string dbPath = $@"C:\temp\{guid}.db";

            if (System.IO.File.Exists(dbPath))
            {
                System.IO.File.Delete(dbPath);
            }

            _db = new SQLite.SQLiteAsyncConnection(dbPath);
            await _db.CreateTableAsync <DummyTable>().ConfigureAwait(false);

            bool exists = System.IO.File.Exists(dbPath);

            Assert.AreEqual(true, exists, "Make sure VS is in Admin mode");

            await _db.CloseAsync();

            if (File.Exists(dbPath))
            {
                File.Delete(dbPath);
            }

            if (File.Exists(dbPath))
            {
                Assert.Fail($"File '{dbPath}' was not deleted");
            }
        }
Ejemplo n.º 2
0
        ////[TestMethod]
        ////public async Task TableInsertTest()
        ////{
        ////  await SaveItemAsync(item);
        ////  var items = await _db.QueryAsync<DummyTable>("SELECT * FROM [DummyTable] WHERE [Done] = 0");
        ////  Assert.AreEqual(1, items.Count);
        ////}

        private void CloseConnection()
        {
            if (_db != null)
            {
                _db.CloseAsync();
            }
        }