Hi

I have a following failing test in an empty project with Windsor 3.1 from NuGet:

        [Test]
        public void TransientInterceptor()
        {
            var interceptorCreated = false;
            var interceptorReleased = false;

            var c = new DefaultKernel();
            c.ComponentCreated += (model, instance) =>
            {
                if (model.Implementation == typeof(AnInterceptor))
                {
                    interceptorCreated = true;
                }
            };
            c.ComponentDestroyed += (model, instance) =>
            {
                if (model.Implementation == typeof(AnInterceptor))
                {
                    interceptorReleased = true;
                }
            };

            c.Register(
                Component.For<AComponent>().LifeStyle.Transient,
                Component.For<AnInterceptor>().LifeStyle.Transient);

            var component = c.Resolve<AComponent>();
            c.ReleaseComponent(component);

            Assert.IsTrue(interceptorCreated);
            Assert.IsTrue(interceptorReleased);
        }

        public class AnInterceptor : IInterceptor
        {
            public void Intercept(IInvocation invocation)
            {
                invocation.Proceed();
            }
        }

        [Interceptor(typeof(AnInterceptor))]
        public class AComponent
        {
            public virtual void Intercepted() 
            {
            }
        }

The test fails on the very last line, i.e. ComponentDestroyed for the 
interceptor is never being called. Is it a bug or am I missing something?

Regards,
Vladimir Okhotnikov

-- 
You received this message because you are subscribed to the Google Groups 
"Castle Project Users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/castle-project-users?hl=en.

Reply via email to