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); }
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)); }
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)); }
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)); }
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); }
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); }