Exemplo n.º 1
0
        public void GenericTest(TypeDefinition type)
        {
            var info = CacheTypeResolver.Resolve(type);

            Assert.Equal(2, info.Methods.Count);

            Assert.Equal(CacheOperation.Get, info.Methods[0].Operation);
            Assert.Equal(CacheOperation.Set, info.Methods[1].Operation);
        }
Exemplo n.º 2
0
        public void TypeTest()
        {
            var info = CacheTypeResolver.Resolve(GetType("NetCache.Tests.CacheTypeResolverTest/TypeTestClass"));

            Assert.Equal("NetCache.Tests.CacheTypeResolverTest/TypeTestClass", info.Name);
            Assert.Equal(GetType("NetCache.Tests.CacheTypeResolverTest/TypeTestClass"), info.Type);
            Assert.Equal(4, info.Methods.Count);

            Assert.Equal(CacheOperation.Get, info.Methods[0].Operation);
            Assert.Equal(CacheOperation.Set, info.Methods[1].Operation);
            Assert.Equal(CacheOperation.Remove, info.Methods[2].Operation);
            Assert.Equal(CacheOperation.Remove, info.Methods[3].Operation);

            var agg = Assert.Throws <AggregateException>(() => CacheTypeResolver.Resolve(GetType("NetCache.Tests.CacheTypeResolverTest/TypeTestClass2")));

            Assert.Single((IEnumerable)agg.InnerExceptions);
            Assert.Equal("不支持的抽象方法Test", agg.InnerException !.Message);
        }