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>))); }
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)); }
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>))); }
internal Data(GuidRevisionValue revision) : base(revision) { _items = CacheFactory.CreateWithLocking <ISecurityPrincipal, AccessTypeCache>(); }