The ResolveAll with Contravariant seems to behave differently in
Castle Windsor 3.0.0 then with 2.5.4. I've made the below test and ran
it against both versions.
Windsor 2.5.4: Pass
Windsor 3.0.0: Fail
Thought it was kinda useful in 2.5.4. Is this by design or a bug? Can
anyone suggest a workaround if it is by design?
public class Derived : Base { }
public class Base { }
public interface IHandle<in T> { void Handle(T message); }
public class HandleBase : IHandle<Base> { public void Handle(Base
message) { } }
public class HandleDerived : IHandle<Derived> { public void
Handle(Derived message) { } }
[TestFixture]
public class CastleTest
{
[Test]
public void ResolvesUsingContravariant()
{
var container = new WindsorContainer();
container.Register(Component.For<IHandle<Base>>().ImplementedBy<HandleBase>());
container.Register(Component.For<IHandle<Derived>>().ImplementedBy<HandleDerived>());
var list = container.ResolveAll<IHandle<Derived>>();
Assert.AreEqual(2, list.Length);
}
}
--
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.