public void When_excluding_types_types_from_assembly_should_not_be_found() { var assemblyScannerConfig = new AssemblyScannerConfiguration(); assemblyScannerConfig.ExcludeTypes(typeof(ThisIsAnExcludedCommand)); var conventions = new Conventions(); conventions.Add(new DelegateMessageConvention() { IsCommandTypeConvention = t => t.Name.EndsWith("Command"), IsMessageTypeConvention = t => t.Name.EndsWith("Message") }); var types = TypesScanner.ScanMessageTypes(assemblyScannerConfig, conventions).ToList(); Assert.Contains(typeof(ACommand), types); Assert.Contains(typeof(AMessage), types); Assert.False(types.Contains(typeof(ThisIsAnExcludedCommand))); }
private void ExcludeMessageHandlers(AssemblyScannerConfiguration assemblyScanner) { var supportedMessageTypes = ConfigHelper.SupportedActionTypes; if (supportedMessageTypes == MessageActionType.All) { return; } foreach (MessageActionType value in Enum.GetValues(typeof(MessageActionType))) { if (value == MessageActionType.All) { continue; } if ((supportedMessageTypes & value) != value) { if (GetMessageActionToHandlerMapping().ContainsKey(value)) { assemblyScanner.ExcludeTypes(GetMessageActionToHandlerMapping()[value]); } } } }