Example #1
0
        public void GetKeysTest()
        {
            barrel.EmptyAll();

            var keysToStore = new[] { "One", "Two", "Three" }.OrderBy(x => x).ToArray();

            foreach (var item in keysToStore)
            {
                barrel.Add(key: item, data: item, expireIn: TimeSpan.FromDays(1));
            }

            var test1 = barrel.GetKeys(CacheState.Active | CacheState.Expired);

            var cachedKeys = barrel.GetKeys().OrderBy(x => x).ToArray();

            Assert.IsNotNull(cachedKeys);
            Assert.IsTrue(cachedKeys.Any());
            for (var i = 0; i < cachedKeys.Length; i++)
            {
                Assert.AreEqual(keysToStore[i], cachedKeys[i]);
            }
        }