public void It_can_contain_more_than_one_type() { var collection = new HandlerSelector(typeof(TestCommandHandler), typeof(AnotherTestCommandHandler)); var firstHandler = collection.GetHandlerFor(typeof(TestCommand)); var secondHandler = collection.GetHandlerFor(typeof(AnotherTestCommand)); Assert.AreEqual(typeof(TestCommandHandler), firstHandler); Assert.AreEqual(typeof(AnotherTestCommandHandler), secondHandler); }
public void It_can_find_handler_by_exact_type() { var collection = new HandlerSelector(typeof(TestCommandHandler)); var handlerType = collection.GetHandlerFor(typeof(TestCommand)); Assert.AreEqual(typeof(TestCommandHandler), handlerType); }
private object CreateHandler(Type commandType) { var handlerType = _handlerSelector.GetHandlerFor(commandType); return(_objectFactory.GetHandlerInstance(handlerType)); }