Esempio n. 1
0
        public void ShouldExecuteGlobalAspects()
        {
            MethodContext startContext = null;
            MethodContext endContext   = null;

            TestAspectAttribute.InterceptStartCallback = (ctx) => startContext = ctx;
            TestAspectAttribute.InterceptEndCallback   = (ctx) => endContext = ctx;
            AspectFactory.RegisterGlobalAspect(new TestAspectAttribute());

            var proxy = AspectFactory.Create <IParameterPassingTest>(new ParameterPassingTest());

            proxy.Test3();

            Assert.IsNotNull(startContext, "InterceptStart was called.");
            Assert.IsNotNull(endContext, "InterceptEnd was called.");
        }