public void testDbPutGetOne()
        {
            var fn = getTempFile();

            try
            {
                using (var storage = new LiteDBStorage(fn))
                {
                    Assert.AreEqual(0, storage.TotalItems);

                    var expected = "hello world";
                    storage.Put(expected);

                    Assert.AreEqual(1, storage.TotalItems);

                    var actual = storage.TakeLast(1);

                    Assert.AreEqual(1, storage.TotalItems);

                    var delete = storage.Delete(new List <string> {
                        actual[0].Id
                    });

                    Assert.IsTrue(delete);
                    Assert.AreEqual(expected, actual[0].Item);
                }
            }
            finally
            {
                File.Delete(fn);
            }
        }
        public void testDbPutMany()
        {
            var fn             = getTempFile();
            int insertionCount = 100;
            var expected       = new List <string>();

            try
            {
                using (var storage = new LiteDBStorage(fn))
                {
                    Assert.AreEqual(0, storage.TotalItems);

                    for (int i = 0; i < insertionCount; i++)
                    {
                        var generated = String.Format("{0}", i);
                        storage.Put(generated);
                        expected.Insert(0, generated);
                    }

                    Assert.AreEqual(insertionCount, storage.TotalItems);

                    var eventRecords = storage.TakeLast(insertionCount);

                    var eventIds = new List <string>();
                    var items    = new List <string>();

                    foreach (var record in eventRecords)
                    {
                        eventIds.Add(record.Id);
                        items.Add(record.Item);
                    }

                    var delete = storage.Delete(eventIds);

                    Assert.IsTrue(delete);
                    Assert.AreEqual(0, storage.TotalItems);

                    CollectionAssert.AreEqual(expected, items);
                }
            }
            finally
            {
                File.Delete(fn);
            }
        }