public void Should_not_filter_if_method_has_no_intercept_attribute_decorated() { var attributeProvider = new DefaulAttributeProvider(); var contextProvider = Substitute.For <IContextProvider>(); var invocation = Substitute.For <_IInvocation>(); invocation.Method.Returns(typeof(MethodInterceptorTests).GetMethod(nameof(MethodWithNoInterceptAttribute))); invocation.MethodInvocationTarget.Returns(typeof(MethodInterceptorTests).GetMethod(nameof(Should_not_filter_if_method_is_not_interceptable))); var interceptor = new MethodInterceptor(attributeProvider, contextProvider); // Action interceptor.Intercept(invocation); // Assert invocation.Received(1).Proceed(); }
internal static void Init() { Cache = new MethodInfoCache(); CacheStrategyProvider = new DefaultCacheStrategyProvider(); AttributeProvider = new DefaulAttributeProvider(); HashCodeGeneratorProvider = new DefaultHashCodeGeneratorProvider(); CacheKeyProvider = new DefaultCacheKeyProvider(HashCodeGeneratorProvider); CacheStoreProvider = new DefaultCacheStoreProvider(); ServiceActivator = new DefaultServiceActivator(); Logger = new NullLogger(); BackgroundTaskManager = new DefaultBackgroundTaskManager(); var configFolder = AppDomain.CurrentDomain.SetupInformation.ApplicationBase; CacheProfileProvider = new YamlCacheProfileProvider(Path.Combine(configFolder ?? "", "cacheProfile.yaml")); }