public void DontCreateProxyWhenNoAdvicesAvailable()
        {
            //Arrange
            var instance = new TestClass();
            var config = new TestBaseConfiguration();

            //Act
            var proxied = ProxyFactory.Create(instance, config);

            //Assert
            Assert.AreEqual(instance, proxied);
        }
        public void DontCreateProxyWhenNoAdvicesCanBeApplied()
        {
            //Arrange
            var instance = new TestClass();
            var config = new TestBaseConfiguration();
            var advice = new TestAdvice();
            config.Add(advice, new NeverApplyAdvice());

            //Act
            var proxied = ProxyFactory.Create(instance, config);

            //Assert
            Assert.AreEqual(instance, proxied);
        }
        public void AdviceShouldBeCalledWhenPointcutSaysSo()
        {
            //Arrange
            var config = new TestBaseConfiguration();
            var mockedAdvice = new Mock<IAdvice>();
            config.Add(mockedAdvice.Object, new AlwaysApplyAdvice());
            var proxied = ProxyFactory.Create<ITestInterface>(new TestClass(), config);

            //Act
            proxied.Foo();

            //Assert
            mockedAdvice.Verify(x => x.ApplyAdvice(It.IsAny<IInvocation>()), Times.Once());
        }