public void Can_Callback_OnAfter()
        {
            var foo = new Foo();
            var proxy = new Proxy<IFoo>()
                .Intercept(f => f.Go())
                .OnInvoke(mi => foo.Go())
                .OnAfter(() => Assert.True(foo.WasExecuted))
                .Save();

            Assert.False(foo.WasExecuted);
            proxy.Go();
        }
        public void Can_Callback_OnBefore_OnFinally_And_OnAfter()
        {
            var ack = 0;
            var foo = new Foo();
            var proxy = new Proxy<IFoo>()
                .Intercept(f => f.Go())
                .OnBefore(() => { ack++; Assert.False(foo.WasExecuted); })
                .OnInvoke(mi => foo.Go())
                .OnFinally(() => ack++)
                .OnAfter(() => { ack++; Assert.True(foo.WasExecuted); })
                .Save();

            proxy.Go();
            Assert.Equal(3, ack);
        }
        public void Shuold_Throw_If_Target_Does_Not_Exist()
        {
            var foo = new Foo();
            var proxy = new Proxy<IFoo>()
                //.Target(foo)
                //.Intercept(f => f.Go())
                .OnBefore(() => Assert.False(foo.WasExecuted))
                .OnInvoke(mi => foo.Go());

            Assert.Throws<ProxyInitializationException>(() => proxy.Save());
        }
        public void Can_Implement_Multiple_Interfaces()
        {
            var foo = new Foo();
            var proxy = new Proxy<IFoo>()
                .Implement(typeof(IDisposable), typeof(ICloneable))
                .Intercept(f => f.Go())
                .OnBefore(() => Assert.False(foo.WasExecuted))
                .OnInvoke(mi => foo.Go())
                .Save();

            Assert.True(typeof(IDisposable).IsAssignableFrom(proxy.GetType()));
            Assert.True(typeof(ICloneable).IsAssignableFrom(proxy.GetType()));
        }