Example #1
0
        public void Get_Last_Item_ByDomain_Test()
        {
            var database = Database.OpenFile(_dbFileName);
            var dateTime = DateTime.Now;

            database.Cache.Insert(new CacheItem()
            {
                Domain       = "d",
                Hash         = Convert.ToBase64String(Guid.NewGuid().ToByteArray()),
                LastAccessed = dateTime,
                LastUpdated  = dateTime,
                Size         = 100
            });

            database.Cache.Insert(new CacheItem()
            {
                Domain       = "d",
                Hash         = Convert.ToBase64String(Guid.NewGuid().ToByteArray()),
                LastAccessed = dateTime,
                LastUpdated  = dateTime,
                Size         = 100
            });


            var cacheItemMetadata = _store.GetEarliestAccessedItem("d");

            Assert.AreEqual(100, cacheItemMetadata.Size);
            Assert.AreEqual("d", cacheItemMetadata.Domain);
            Assert.AreEqual(dateTime, cacheItemMetadata.LastAccessed);
        }