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