public async Task TestSingleMapping()
        {
            SQLiteConnection sqlite = new SQLiteConnection("Data Source=:memory:");

            sqlite.Open();
            FillDatabase(sqlite);
            SimpleDbMapper mapper         = new SimpleDbMapper();
            long           memUsageBefore = GC.GetTotalMemory(true);
            var            sw             = Stopwatch.StartNew();
            var            result         = await mapper.GetAsync <User>(sqlite, "SELECT Name FROM Users WHERE Id = 1", null, CancellationToken.None);

            sw.Stop();
            var memoryUsed     = ((double)GC.GetTotalMemory(false) - memUsageBefore).ToReadableBytes();
            var meanMemoryUsed = ((double)GC.GetTotalMemory(true) - memUsageBefore).ToReadableBytes();
        }
 public void CanConvertTestProductToSimpleDb()
 {
     ISimpleDbMapper<TestProduct> mapper = new SimpleDbMapper<TestProduct>(); 
     var p = new TestProduct();
     p.AvailableFrom = DateTime.Now;
     p.Discontinued = false;
     p.Id = Guid.NewGuid();
     p.Name = "Sample Product";
     p.Price = 4.5m;
     p.Quantity = 25;
     p.ItemStatus = ItemStatus.Draft;
     var theList = new List<string>();
     theList.Add("blue");
     theList.Add("green");
     theList.Add("red");
     p.Tags = theList;
     var convertedAttributes = mapper.MapEntityToAttributes(p);
     
 }
        public async Task TestLazyMapping()
        {
            SQLiteConnection sqlite = new SQLiteConnection("Data Source=:memory:");

            sqlite.Open();
            FillDatabase(sqlite);
            SimpleDbMapper mapper         = new SimpleDbMapper();
            long           memUsageBefore = GC.GetTotalMemory(true);
            var            sw             = Stopwatch.StartNew();

            for (int i = 0; i < 1; i++)
            {
                var result = await mapper.GetAsync <long>(sqlite, "SELECT Count(*) FROM Users", null, CancellationToken.None);
            }

            sw.Stop();
            var memoryUsed     = ((double)GC.GetTotalMemory(false) - memUsageBefore);
            var meanMemoryUsed = ((double)GC.GetTotalMemory(true) - memUsageBefore);
        }
        public void Create_Read_Update_Delete_TestProduct()
        {
            var testProduct = new TestProduct();
            testProduct.AvailableFrom = DateTime.Now;
            testProduct.Discontinued = false;
            testProduct.Id = Guid.NewGuid();
            testProduct.Name = "Sample Product";
            testProduct.Price = 4.5m;
            testProduct.Quantity = 25;
            testProduct.ItemStatus = ItemStatus.Draft;
            var theList = new List<string>();
            theList.Add("blue");
            theList.Add("green");
            theList.Add("red");
            testProduct.Tags = theList;
            var mapper = new SimpleDbMapper<TestProduct>();
            var test = new SimpleDbFacade<TestProduct>(this._simpleDbConfiguration, mapper);
            test.CreateItem(testProduct);

            var returnedProduct = test.GetItemById(testProduct.Id); 
            Assert.IsNotNull(returnedProduct);
            AssertEqual(testProduct, returnedProduct);

            returnedProduct.Name = "Updated Sample";
            returnedProduct.Price = 5m;
            returnedProduct.Quantity = 60;
            returnedProduct.ItemStatus = ItemStatus.Published;
            returnedProduct.Discontinued = true;
            returnedProduct.AvailableFrom = DateTime.Now.AddDays(-1);
            returnedProduct.Tags = new List<string>();

            test.UpdateItem(returnedProduct);

            var updatedProduct = test.GetItemById(testProduct.Id);
            Assert.IsNotNull(updatedProduct);
            AssertEqual(updatedProduct, returnedProduct);
            
            test.DeleteItem(testProduct.Id);
            
            var deletedProduct = test.GetItemById(testProduct.Id);
            Assert.IsNull(deletedProduct);
        }