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

            Assert.Throws<InvalidOperationException>(() => proxy.Fail());
            Assert.True(foo.WasExecuted);
        }
        public void Can_Callback_OnCatch_And_OnFinally()
        {
            var ack = 0;
            var foo = new Foo();
            var proxy = new Proxy<IFoo>()
                .Intercept(f => f.Fail())
                .OnInvoke(mi => foo.Fail())
                .OnCatch(e => Assert.IsAssignableFrom<InvalidOperationException>(e))
                .OnFinally(() => ack++)
                .Save();

            proxy.Fail();
            Assert.Equal(1, ack);
        }