private void _TouchAllCacheItems(TaggedScavengedExpirableCacheStore cacheStore)
 {
     foreach (string key in cacheStore.GetKeys())
     {
         cacheStore.Get(key);
     }
 }
        private void _EnsureTagExpirationStateValidity(TaggedScavengedExpirableCacheStore cacheStore)
        {
            foreach (string key in cacheStore.GetKeys())
            {
                CacheItem cacheItem = cacheStore.Get(key);
                if (cacheItem != null)
                {
                    IExpirationSpecifier[] expirationSpecifierList = (IExpirationSpecifier[])Array.FindAll(cacheItem.ExpirationSpecifierList, (esp) => esp is TagExpirationSpecifier);
                    foreach (TagExpirationSpecifier expirationSpecifier in expirationSpecifierList)
                    {
                        PropertyInfo tagInfoPropertyInfo = expirationSpecifier.GetType().GetProperty("_TagInfoList", BindingFlags.NonPublic | BindingFlags.Instance);
                        PropertyInfo tagInvalidationPropertyInfo = expirationSpecifier.GetType().GetProperty("_TagInvalidationTokenList", BindingFlags.NonPublic | BindingFlags.Instance);

                        List<TagInfo> tagInfoList = (List<TagInfo>) tagInfoPropertyInfo.GetValue(expirationSpecifier, null);
                        List<object> invalidationTokenList = (List<object>)tagInvalidationPropertyInfo.GetValue(expirationSpecifier, null);

                        for(int i = 0; i < tagInfoList.Count; ++i)
                        {
                            foreach (TagInvalidationInfo invalidationInfo in tagInfoList[i].TagInvalidationInfoList.GetEnumerable(invalidationTokenList[i]))
                            {
                                Assert.Fail("invalidation token is not supposed to be available");
                            }
                        }
                    }
                }
            }
        }
        private List<string> _GetTagsReferredInCacheItems(TaggedScavengedExpirableCacheStore cacheStore)
        {
            HashSet<string> tagSet = new HashSet<string>();

            foreach (string key in cacheStore.GetKeys())
            {
                CacheItem cacheItem = cacheStore.Get(key);
                if (cacheItem != null)
                {
                    IExpirationSpecifier[] expirationSpecifierList = (IExpirationSpecifier[])Array.FindAll(cacheItem.ExpirationSpecifierList, (esp) => esp is TagExpirationSpecifier);
                    foreach (TagExpirationSpecifier expirationSpecifier in expirationSpecifierList)
                    {
                        PropertyInfo propertyInfo = expirationSpecifier.GetType().GetProperty("_TagInfoList", BindingFlags.NonPublic | BindingFlags.Instance);
                        List<TagInfo> tagInfoList = (List<TagInfo>)propertyInfo.GetValue(expirationSpecifier, null);
                        tagInfoList.ForEach(ti => tagSet.Add(ti.Tag));
                    }
                }
            }

            return tagSet.ToList();
        }
        private void _EnsureCacheItemsDontMatch(TaggedScavengedExpirableCacheStore cacheStore, List<string> tagCombinationList)
        {
            HashSet<string> tagCombination = new HashSet<string>(tagCombinationList);

            foreach (string key in cacheStore.GetKeys())
            {
                CacheItem cacheItem = cacheStore.Get(key);
                if (cacheItem != null)
                {
                    IExpirationSpecifier[] expirationSpecifierList = (IExpirationSpecifier[])Array.FindAll(cacheItem.ExpirationSpecifierList, (esp) => esp is TagExpirationSpecifier);
                    foreach (TagExpirationSpecifier expirationSpecifier in expirationSpecifierList)
                    {
                        PropertyInfo propertyInfo = expirationSpecifier.GetType().GetProperty("_TagInfoList", BindingFlags.NonPublic | BindingFlags.Instance);
                        List<TagInfo> tagInfoList = (List<TagInfo>)propertyInfo.GetValue(expirationSpecifier, null);

                        bool subset = true;
                        foreach(string tag in tagCombinationList)
                        {
                            subset = subset && tagInfoList.Exists(t => t.Tag == tag);
                        }

                        Assert.IsFalse(subset);
                    }
                }
            }
        }