Пример #1
0
 public void Should_run_a_callback_after_target_execution()
 {
     bool ack = false;
     var target = new Foo();
     var interceptor = new OnAfterInterceptor{ Action = ()=> { Assert.True(target.Executed); ack = true; } };
     var factory = new ProxyFactory(AppConfig.ProxyBehavior);
     var proxy = factory.Create<IFoo>(target, interceptor);
     proxy.Go();
     Assert.True(ack);
 }
Пример #2
0
        public void Should_run_a_callback_after_target_execution()
        {
            bool ack         = false;
            var  target      = new Foo();
            var  interceptor = new OnAfterInterceptor {
                Action = () => { Assert.True(target.Executed); ack = true; }
            };
            var factory = new ProxyFactory(AppConfig.ProxyBehavior);
            var proxy   = factory.Create <IFoo>(target, interceptor);

            proxy.Go();
            Assert.True(ack);
        }