I'm trying to make this registration work. I have a number of IEventFactory<> responsible for creating different (external) events within my application.
I'd like to resolve all kinds of factories just by it's interface, eg IEventFactory<ClassA>. How do I make my test below succeed?
[TestFixture]
public class WindsorTests
{
[Test]
public void Test_factory_registration()
{
WindsorContainer container = new WindsorContainer();
container.AddFacility<TypedFactoryFacility>();
container.Register(AllTypes.FromThisAssembly().BasedOn(typeof(IEventFactory<>)).WithService.AllInterfaces());
IEventFactory<ClassA> factoryA = container.Resolve<IEventFactory<ClassA>>();
IEventFactory<ClassB> factoryB = container.Resolve<IEventFactory<ClassB>>();
}
class ClassA
{
}
class ClassB
{
}
interface IEventFactory<TCaller>
{
void Foo();
}
class EventFactoryA : IEventFactory<ClassA>
{
public void Foo()
{
throw new NotImplementedException();
}
}
class EventFactoryB : IEventFactory<ClassB>
{
public void Foo()
{
throw new NotImplementedException();
}
}
}