public void CreateWithLazyLocking_CacheInvalidationTokenOverload_IEqualityComparerOverload() { var cacheInvalidationToken = InvalidationToken.CreatWithLocking(); var result = CacheFactory.CreateWithLazyLocking <string, object> (cacheInvalidationToken, _comparer); Assert.That(result, Is.TypeOf(typeof(LazyLockingCachingAdapter <string, object>))); var innerCache1 = PrivateInvoke.GetNonPublicField(result, "_innerCache"); Assert.That( innerCache1, Is.TypeOf(typeof(LockingCacheDecorator <string, DoubleCheckedLockingContainer <LazyLockingCachingAdapter <string, object> .Wrapper> >))); var innerCache2 = PrivateInvoke.GetNonPublicField(innerCache1, "_innerCache"); Assert.That( innerCache2, Is.TypeOf( typeof(InvalidationTokenBasedCacheDecorator <string, DoubleCheckedLockingContainer <LazyLockingCachingAdapter <string, object> .Wrapper> >))); Assert.That( ((InvalidationTokenBasedCacheDecorator <string, DoubleCheckedLockingContainer <LazyLockingCachingAdapter <string, object> .Wrapper> >) innerCache2).InvalidationToken, Is.SameAs(cacheInvalidationToken)); var innerCache3 = PrivateInvoke.GetNonPublicField(innerCache2, "_innerCache"); Assert.That( innerCache3, Is.TypeOf(typeof(Cache <string, DoubleCheckedLockingContainer <LazyLockingCachingAdapter <string, object> .Wrapper> >))); var underlyingDataStore = PrivateInvoke.GetNonPublicField(innerCache3, "_dataStore"); Assert.That( underlyingDataStore, Is.TypeOf(typeof(SimpleDataStore <string, DoubleCheckedLockingContainer <LazyLockingCachingAdapter <string, object> .Wrapper> >))); Assert.That( ((SimpleDataStore <string, DoubleCheckedLockingContainer <LazyLockingCachingAdapter <string, object> .Wrapper> >)underlyingDataStore).Comparer, Is.SameAs(_comparer)); }
public void CreateWithLazyLocking() { var result = CacheFactory.CreateWithLazyLocking <string, object>(); Assert.That(result, Is.TypeOf(typeof(LazyLockingCachingAdapter <string, object>))); var innerCache1 = PrivateInvoke.GetNonPublicField(result, "_innerCache"); Assert.That( innerCache1, Is.TypeOf(typeof(LockingCacheDecorator <string, DoubleCheckedLockingContainer <LazyLockingCachingAdapter <string, object> .Wrapper> >))); var innerCache2 = PrivateInvoke.GetNonPublicField(innerCache1, "_innerCache"); Assert.That( innerCache2, Is.TypeOf(typeof(Cache <string, DoubleCheckedLockingContainer <LazyLockingCachingAdapter <string, object> .Wrapper> >))); }
internal Data(GuidRevisionValue revision) : base(revision) { _items = CacheFactory.CreateWithLazyLocking <ISecurityContext, AccessType[]>(); }