public void create_message_handler_of_different_type_should_not_match_message_handler_type() { var creator = new MessageHandlerTypeCreator(); var createdType = creator.Create(typeof(AppleCommand)); createdType.Should().NotBe(typeof(IMessageHandler <BananaCommand>)); }
public void create_message_handler_of_type_should_match_message_handler_type() { var creator = new MessageHandlerTypeCreator(); var createdType = creator.Create(typeof(AppleCommand)); createdType.Should().Be(typeof(IMessageHandler <AppleCommand>)); }
private void InitializeMapsWithDependencyResolver(IDependencyResolver dependencyResolver, MessageScanner scanner) { using (var resolver = dependencyResolver.CreateScope()) { var creator = new MessageHandlerTypeCreator(); foreach (var type in scanner.EventTypes) { var isReceivingType = resolver.Resolve(creator.Create(type)) != null; if (isReceivingType) { nameToMessageTypeReceivingEventMap.Add(type.FullName, type); messageTypeToNameReceivingEventMap.Add(type, type.FullName); } else { nameToMessageTypePublishingEventMap.Add(type.FullName, type); messageTypeToNamePublishingEventMap.Add(type, type.FullName); } } foreach (var type in scanner.CommandTypes) { var isReceivingType = resolver.Resolve(creator.Create(type)) != null; if (isReceivingType) { nameToMessageTypeReceivingCommandMap.Add(type.FullName, type); messageTypeToNameReceivingCommandMap.Add(type, type.FullName); } else { nameToMessageTypeSendingCommandMap.Add(type.FullName, type); messageTypeToNameSendingCommandMap.Add(type, type.FullName); } } } }
void when_creating_a_command_type <T>() { _createdType = _messageHandlerTypeCreator.Create(typeof(T)); }