public void Clear_NoSupression()
        {
            const string cacheName = "My Precious";

            Tuple <long, string>[] testData =
            {
                new Tuple <long, string>(26,  "foo"),
                new Tuple <long, string>(986, "bar")
            };
            string value;

            IDistributedMemoryManager memoryManager = Factory.DistributedMemoryManager;

            using (RedisPubSubCache <long, string> redisPubSubCache1 = new RedisPubSubCache <long, string>(
                       new DictionaryCache <long, string>( ), cacheName, memoryManager))
                using (RedisPubSubCache <long, string> redisPubSubCache2 = new RedisPubSubCache <long, string>(
                           new DictionaryCache <long, string>( ), cacheName, memoryManager))
                {
                    foreach (Tuple <long, string> testDatum in testData)
                    {
                        redisPubSubCache1.Add(testDatum.Item1, testDatum.Item2);
                        redisPubSubCache2.Add(testDatum.Item1, testDatum.Item2);
                    }

                    CountdownEvent evt = new CountdownEvent(1);

                    EventHandler <MessageEventArgs <RedisPubSubCacheMessage <long> > > handler = (sender, message) =>
                    {
                        evt.Signal( );
                    };

                    redisPubSubCache2.Channel.MessageReceived += handler;

                    redisPubSubCache1.Clear();

                    // Wait for message
                    evt.Wait(DefaultRedisWaitTime);

                    redisPubSubCache2.Channel.MessageReceived -= handler;

                    Assert.That(redisPubSubCache1.TryGetValue(testData[0].Item1, out value), Is.False, "Item 1 not removed from cache 1");
                    Assert.That(redisPubSubCache2.TryGetValue(testData[0].Item1, out value), Is.False, "Item 1 not removed from cache 2");
                    Assert.That(redisPubSubCache1.TryGetValue(testData[1].Item1, out value), Is.False, "Item 2 not removed from cache 1");
                    Assert.That(redisPubSubCache2.TryGetValue(testData[1].Item1, out value), Is.False, "Item 2 not removed from cache 2");
                    Assert.That(redisPubSubCache1, Is.Empty, "Cache 1 not empty");
                    Assert.That(redisPubSubCache2, Is.Empty, "Cache 2 not empty");
                }
        }
        public void Clear_Supression()
        {
            const string cacheName = "My Precious";

            Tuple <long, string>[] testData =
            {
                new Tuple <long, string>(26,  "foo"),
                new Tuple <long, string>(986, "bar")
            };
            string value;

            IDistributedMemoryManager memoryManager = Factory.DistributedMemoryManager;

            using (RedisPubSubCache <long, string> redisPubSubCache1 = new RedisPubSubCache <long, string>(
                       new DictionaryCache <long, string>( ), cacheName, memoryManager))
                using (RedisPubSubCache <long, string> redisPubSubCache2 = new RedisPubSubCache <long, string>(
                           new DictionaryCache <long, string>( ), cacheName, memoryManager))
                {
                    foreach (Tuple <long, string> testDatum in testData)
                    {
                        redisPubSubCache1.Add(testDatum.Item1, testDatum.Item2);
                        redisPubSubCache2.Add(testDatum.Item1, testDatum.Item2);
                    }

                    using (new RedisCacheMessageSuppressionContext(cacheName))
                    {
                        redisPubSubCache1.Clear();
                    }

                    Assert.That(redisPubSubCache1.TryGetValue(testData[0].Item1, out value), Is.False, "Item 1 not removed from cache 1");
                    Assert.That(redisPubSubCache2.TryGetValue(testData[0].Item1, out value), Is.True, "Item 1 removed from cache 2");
                    Assert.That(redisPubSubCache1.TryGetValue(testData[1].Item1, out value), Is.False, "Item 2 not removed from cache 1");
                    Assert.That(redisPubSubCache2.TryGetValue(testData[1].Item1, out value), Is.True, "Item 2 removed from cache 2");
                    Assert.That(redisPubSubCache1, Is.Empty, "Cache 1 not empty");
                    Assert.That(redisPubSubCache2, Is.Not.Empty, "Cache 2 not empty");
                }
        }