Exemplo n.º 1
0
        public void GetOrSetTtlTest()
        {
            var methods = GetType("NetCache.Tests.CacheTypeResolverTest/TtlClass").GetMethods().Where(m => m.Name == "Get").ToArray();

            for (var index = 0; index < methods.Length - 1; index++)
            {
                var method = CacheTypeResolver.ResolveGet(methods[index]) !;

                Assert.NotNull(method);
                Assert.Equal(1, method.Ttl);
                Assert.Equal(0, method.CancellationToken);
            }
#if NETCOREAPP3_1_OR_GREATER
            Assert.Null(CacheTypeResolver.ResolveGet(methods[^ 1]));
Exemplo n.º 2
0
        public void GetOrSetTtlTest()
        {
            var methods = typeof(TtlClass).GetMethods().Where(m => m.Name == nameof(TtlClass.Get)).ToArray();

            for (var index = 0; index < methods.Length - 1; index++)
            {
                var method = CacheTypeResolver.ResolveGet(methods[index]) !;

                Assert.NotNull(method);
                Assert.Equal(1, method.Ttl);
                Assert.Equal(0, method.CancellationToken);
            }

            Assert.Null(CacheTypeResolver.ResolveGet(methods[methods.Length - 1]));
        }