示例#1
0
        public void CreateWithLocking()
        {
            var result = CacheFactory.CreateWithLocking <string, int>();

            Assert.That(result, Is.TypeOf(typeof(LockingCacheDecorator <string, int>)));
            var innerCache = PrivateInvoke.GetNonPublicField(result, "_innerCache");

            Assert.That(innerCache, Is.TypeOf(typeof(Cache <string, int>)));
        }
示例#2
0
        public void CreateWithLocking_IEqualityComparerOverload()
        {
            var result = CacheFactory.CreateWithLocking <string, int> (_comparer);

            Assert.That(result, Is.TypeOf(typeof(LockingCacheDecorator <string, int>)));
            var innerCache = PrivateInvoke.GetNonPublicField(result, "_innerCache");

            Assert.That(innerCache, Is.TypeOf(typeof(Cache <string, int>)));
            var innerDataStore = PrivateInvoke.GetNonPublicField(innerCache, "_dataStore");

            Assert.That(((SimpleDataStore <string, int>)innerDataStore).Comparer, Is.SameAs(_comparer));
        }
示例#3
0
        public void CreateWithLocking_CacheInvalidationTokenOverload()
        {
            var cacheInvalidationToken = InvalidationToken.CreatWithLocking();
            var result = CacheFactory.CreateWithLocking <string, int> (cacheInvalidationToken);

            Assert.That(result, Is.TypeOf(typeof(LockingCacheDecorator <string, int>)));
            var innerCache1 = PrivateInvoke.GetNonPublicField(result, "_innerCache");

            Assert.That(innerCache1, Is.TypeOf(typeof(InvalidationTokenBasedCacheDecorator <string, int>)));
            Assert.That(((InvalidationTokenBasedCacheDecorator <string, int>)innerCache1).InvalidationToken, Is.SameAs(cacheInvalidationToken));
            var innerCache2 = PrivateInvoke.GetNonPublicField(innerCache1, "_innerCache");

            Assert.That(innerCache2, Is.TypeOf(typeof(Cache <string, int>)));
        }
示例#4
0
 internal Data(GuidRevisionValue revision)
     : base(revision)
 {
     _items = CacheFactory.CreateWithLocking <ISecurityPrincipal, AccessTypeCache>();
 }