コード例 #1
0
        public void TestGetCacheItemPolicy()
        {
            var testService = new UserCacheService(cache.Object, expectedTimeToLive);
            var policy      = testService.GetCacheItemPolicy();

            Assert.IsNotNull(policy);
            Assert.IsNotNull(policy.SlidingExpiration);
            Assert.IsNotNull(policy.RemovedCallback);
            policy.Invoking(x => x.RemovedCallback(new CacheEntryRemovedArguments(cache.Object, CacheEntryRemovedReason.Removed, new CacheItem(Guid.NewGuid().ToString())))).ShouldNotThrow();
            Assert.AreEqual(1, policy.ChangeMonitors.Count);
            Assert.IsInstanceOfType(policy.ChangeMonitors.First(), typeof(CamRoleChangeMonitor));
        }