Oops, forgot that microkernel does not work with interceptors. Still, this one fails:
[Test]
public void TransientInterceptor()
{
var interceptorCreated = false;
var interceptorReleased = false;
var c = new WindsorContainer();
c.Kernel.ComponentCreated += (model, instance) =>
{
if (model.Implementation == typeof(AnInterceptor))
{
interceptorCreated = true;
}
};
c.Kernel.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.Kernel.ReleaseComponent(component);
Assert.IsTrue(interceptorCreated);
Assert.IsTrue(interceptorReleased);
}
вторник, 6 ноября 2012 г., 10:59:53 UTC+2 пользователь Vladimir Okhotnikov написал:
Hi
I have a following failing test in an empty project with Windsor 3.1 from NuGet: