Beispiel #1
0
        public void TestViewBuilderCacheValues()
        {
            INamedCache cache = new ViewBuilder(GetCache("v-cachingValues")).Values().Build();

            Assert.IsInstanceOf(typeof(ContinuousQueryCache), cache);

            ContinuousQueryCache queryCache = (ContinuousQueryCache)cache;

            Assert.That(queryCache.CacheValues, Is.True);
        }
Beispiel #2
0
        public void TestViewBuilderWithTransformer()
        {
            IValueExtractor transformer = new IdentityExtractor();
            INamedCache     cache       = new ViewBuilder(GetCache("v-transformer")).Map(transformer).Build();

            Assert.IsInstanceOf(typeof(ContinuousQueryCache), cache);

            ContinuousQueryCache queryCache = (ContinuousQueryCache)cache;

            Assert.That(queryCache.Transformer, Is.EqualTo(transformer));
        }
Beispiel #3
0
        public void TestViewBuilderWithListener()
        {
            ICacheListener listener = new TestCacheListener();
            INamedCache    cache    = new ViewBuilder(GetCache("v-listener")).Listener(listener).Build();

            Assert.IsInstanceOf(typeof(ContinuousQueryCache), cache);

            ContinuousQueryCache queryCache = (ContinuousQueryCache)cache;

            Assert.That(queryCache.CacheListener, Is.EqualTo(listener));
        }
Beispiel #4
0
        public void TestViewBuilderWithFilter()
        {
            IFilter     filter = new EqualsFilter("foo", "bar");
            INamedCache cache  = new ViewBuilder(GetCache("v-filter")).Filter(filter).Build();

            Assert.IsInstanceOf(typeof(ContinuousQueryCache), cache);

            ContinuousQueryCache queryCache = (ContinuousQueryCache)cache;

            Assert.That(queryCache.Filter, Is.EqualTo(filter));
        }
Beispiel #5
0
        public void TestViewBuilderKeysOnly()
        {
            IValueExtractor transformer = new IdentityExtractor();
            INamedCache     cache       = new ViewBuilder(GetCache("v-keysOnly")).Keys().Build();

            Assert.IsInstanceOf(typeof(ContinuousQueryCache), cache);

            ContinuousQueryCache queryCache = (ContinuousQueryCache)cache;

            Assert.That(queryCache.CacheValues, Is.False);
        }
Beispiel #6
0
        public void TestViewBuilderDefaults()
        {
            INamedCache cache = new ViewBuilder(GetCache("v-defaults")).Build();

            Assert.IsInstanceOf(typeof(ContinuousQueryCache), cache);

            ContinuousQueryCache queryCache = (ContinuousQueryCache)cache;

            Assert.That(queryCache.Filter, Is.EqualTo(AlwaysFilter.Instance));
            Assert.That(queryCache.IsReadOnly, Is.False);
            Assert.That(queryCache.CacheListener, Is.Null);
            Assert.That(queryCache.Transformer, Is.Null);
            Assert.That(queryCache.ReconnectInterval, Is.EqualTo(0L));
            Assert.That(queryCache.CacheNameSupplier, Is.Null);
            Assert.That(queryCache.CacheValues, Is.False);
        }