public void TestProduceWithEqualityComparer()
        {
            var cache4  = CacheFactory.NewLRUCache(2);
            var subject = CacheFactory <string, int> .For(cache4, StringComparer.CurrentCultureIgnoreCase);

            Assert.AreEqual(42, subject.Produce("foo", key => 42));
            Assert.AreEqual(42, subject.Produce("FOO", key => - 1));

            Iterator4Assert.AreEqual(new object[] { 42 }, cache4);
        }
        public void TestProduce()
        {
            var cache4Mock = new Cache4Mock();
            var subject    = CacheFactory <string, int> .For(cache4Mock);

            cache4Mock.Verify();
            Assert.AreEqual(42, subject.Produce("42", key => 42));
            cache4Mock.Verify(new MethodCall("Produce", new object[] { "42" }));

            cache4Mock.Reset();
            Assert.AreEqual(-1, subject.Produce("42", key => - 1));
            cache4Mock.Verify(new MethodCall("Produce", new object[] { "42" }));
        }
        private MetadataResolver()
        {
            _assemblyCache = CacheFactory <Assembly, AssemblyDefinition> .For(CacheFactory.New2QXCache(5));

            _methodCache = CacheFactory <MethodInfo, MethodDefinition> .For(CacheFactory.New2QXCache(5));
        }
示例#4
0
 internal static ICache4 <Expression, IQueryBuilderRecord> NewInstance(int cacheSize)
 {
     return(CacheFactory <Expression, IQueryBuilderRecord> .For(CacheFactory.New2QXCache(cacheSize), ExpressionEqualityComparer.Instance));
 }