public async Task SQLiteAsyncGetItemsTest()
        {
            SqliteStorageAsync storage = new SqliteStorageAsync();
            StorageModel model = new StorageModel() { Name = "name1", Value = "value1" };
            string key1 = "Person1/1";
            string key2 = "Person1/2";
            string key3 = "Person1/3";

            await storage.AddItemAsync(key1, model);
            await storage.AddItemAsync(key2, model);
            await storage.AddItemAsync(key3, model);

            List<StorageModel> models = await storage.GetItemsAsync<StorageModel>("Person1/0");

            Assert.AreEqual(models.Count, 3);

            await storage.FlushAllAsync();
        }
        public async Task SQLiteAsyncGetItemTest()
        {
            SqliteStorageAsync storage = new SqliteStorageAsync();
            StorageModel model = new StorageModel() { Name = "name1", Value = "value1" };
            string key = "Person/1";
            await storage.AddItemAsync(key, model);

            StorageModel result =await storage.GetItemAsync<StorageModel>(key);

            Assert.AreEqual(model, result);
        }
        public async Task SQLiteAsyncDelteItemTest()
        {
            SqliteStorageAsync storage = new SqliteStorageAsync();
            StorageModel model = new StorageModel() { Name = "name1", Value = "value1" };
            string key = "Person/1";

            await storage.AddItemAsync(key, model);
            Assert.IsTrue(await storage.ContainItemAsync(key));

            await storage.RemoveItemAsync(key);
            Assert.IsFalse(await storage.ContainItemAsync(key));
        }
Exemplo n.º 4
0
        public async Task SQLiteAsyncGetItemsTest()
        {
            SqliteStorageAsync storage = new SqliteStorageAsync();
            StorageModel       model   = new StorageModel()
            {
                Name = "name1", Value = "value1"
            };
            string key1 = "Person1/1";
            string key2 = "Person1/2";
            string key3 = "Person1/3";

            await storage.AddItemAsync(key1, model);

            await storage.AddItemAsync(key2, model);

            await storage.AddItemAsync(key3, model);

            List <StorageModel> models = await storage.GetItemsAsync <StorageModel>("Person1/0");

            Assert.AreEqual(models.Count, 3);

            await storage.FlushAllAsync();
        }
Exemplo n.º 5
0
        public async Task SQLiteAsyncGetItemTest()
        {
            SqliteStorageAsync storage = new SqliteStorageAsync();
            StorageModel       model   = new StorageModel()
            {
                Name = "name1", Value = "value1"
            };
            string key = "Person/1";
            await storage.AddItemAsync(key, model);

            StorageModel result = await storage.GetItemAsync <StorageModel>(key);

            Assert.AreEqual(model, result);
        }
        public async Task SQLiteAsyncUpdateItemTest()
        {
            SqliteStorageAsync storage = new SqliteStorageAsync();
            StorageModel model = new StorageModel() { Name = "name1", Value = "value1" };
            string key = "Person/1";

            await storage.AddItemAsync(key, model);

            model.Value = "value2";
            await storage.UpdateItemAsync(key, model);

            StorageModel reust = await storage.GetItemAsync<StorageModel>(key);

            Assert.AreEqual(reust.Value, "value2");
        }
Exemplo n.º 7
0
        public async Task SQLiteAsyncDelteItemTest()
        {
            SqliteStorageAsync storage = new SqliteStorageAsync();
            StorageModel       model   = new StorageModel()
            {
                Name = "name1", Value = "value1"
            };
            string key = "Person/1";

            await storage.AddItemAsync(key, model);

            Assert.IsTrue(await storage.ContainItemAsync(key));

            await storage.RemoveItemAsync(key);

            Assert.IsFalse(await storage.ContainItemAsync(key));
        }
Exemplo n.º 8
0
        public async Task SQLiteAsyncUpdateItemTest()
        {
            SqliteStorageAsync storage = new SqliteStorageAsync();
            StorageModel       model   = new StorageModel()
            {
                Name = "name1", Value = "value1"
            };
            string key = "Person/1";

            await storage.AddItemAsync(key, model);

            model.Value = "value2";
            await storage.UpdateItemAsync(key, model);

            StorageModel reust = await storage.GetItemAsync <StorageModel>(key);

            Assert.AreEqual(reust.Value, "value2");
        }