public void Can_Intercept_Multiple_Methods_Using_A_Filter()
        {
            var ack = 0;
            var foo = new Foo();
            var proxy = new Proxy<IFoo>()
                .Target(foo)
                .InterceptWhere(mi => mi.Name.EndsWith("Go"))
                //.InterceptWhere(mi => mi.IsGenericMethod )
                .OnBefore(mi => ack++)
                .Save();

            // intercepted
            proxy.Go();
            proxy.GenericGo<int>(-1);
            proxy.OverloadedGo(-1);
            proxy.OverloadedGo(string.Empty);

            // not intercepted
            proxy.Name = string.Empty;
            proxy.Return();

            Assert.Equal(4, ack);
        }
        public void Can_Intercept_Overloaded_Methods()
        {
            var ack = false;
            var foo = new Foo();
            var proxy = new Proxy<IFoo>()
                .Target(foo)
                .InterceptMethod(f => f.OverloadedGo(It.Any<string>()))
                .OnBefore(() => ack = true)
                .Save();

            proxy.OverloadedGo(-1); // not intercepted
            Assert.False(ack);
            proxy.OverloadedGo(string.Empty); // intercepted
            Assert.True(ack);
        }
        public void Can_Intercept_Many_Methods_With_One_Advice()
        {
            var ack = 0;
            var foo = new Foo();
            var proxy = new Proxy<IFoo>()
                .Target(foo)
                .InterceptMethods(
                    f => f.Return(),
                    f => f.GenericGo<int>(It.Any<int>()),
                    f => f.Go())
                .OnBefore(mi => ack++)
                .Save();

            // intercepted
            proxy.Go();
            proxy.Return();
            proxy.GenericGo<int>(-1);

            // not intercepted
            proxy.Name = string.Empty;
            proxy.OverloadedGo(-1);
            proxy.OverloadedGo(string.Empty);

            Assert.Equal(3, ack);
        }