示例#1
0
        public void With_Type_Interceptor_Test()
        {
            var Configure = new AspectConfigure();

            var matcher = new InterceptorMatcher(Configure);
            var method  = ReflectionExtensions.GetMethod <Action <WithInterceptorMatcherModel> >(m => m.WithOutInterceptor());

            var interceptors = matcher.Match(method, typeof(WithInterceptorMatcherModel).GetTypeInfo());

            Assert.NotEmpty(interceptors);
            Assert.Single(interceptors);
        }
示例#2
0
        public void WithOutInterceptor_Test()
        {
            var Configure = new AspectConfigure();

            var matcher = new InterceptorMatcher(Configure);

            var method = ReflectionExtensions.GetMethod <Action <InterceptorMatcherModel> >(m => m.WithOutInterceptor());

            var interceptors = matcher.Match(method, method.DeclaringType.GetTypeInfo());

            Assert.Empty(interceptors);
        }
示例#3
0
        public void With_Configure_Interceptor_Test()
        {
            var Configure = new AspectConfigure();

            var ConfigureInterceptor = new InjectedInterceptor();

            Configure.GetConfigureOption <IInterceptor>().Add(m => ConfigureInterceptor);

            var matcher = new InterceptorMatcher(Configure);
            var method  = ReflectionExtensions.GetMethod <Action <InterceptorMatcherModel> >(m => m.ConfigureInterceptor());

            var interceptors = matcher.Match(method, method.DeclaringType.GetTypeInfo());

            Assert.NotEmpty(interceptors);

            Assert.Single(interceptors, ConfigureInterceptor);
        }