public void Describe_T() { var act = EventHandlerDescriptor.Describe <EmptyEventHandler>(EventHandlerActivationType.Singleton); act.ActivationType.ShouldBe(EventHandlerActivationType.Singleton); act.HandlerType.ShouldBe(typeof(EmptyEventHandler)); }
public void Describe() { Should.Throw <ArgumentException>(() => EventHandlerDescriptor.Describe(typeof(object), EventHandlerActivationType.Singleton)); var act = EventHandlerDescriptor.Describe(typeof(EmptyEventHandler), EventHandlerActivationType.Singleton); act.ActivationType.ShouldBe(EventHandlerActivationType.Singleton); act.HandlerType.ShouldBe(typeof(EmptyEventHandler)); }
/// <summary> /// /// </summary> /// <param name="options"></param> /// <param name="activationType"></param> /// <typeparam name="TEventHandler"></typeparam> /// <returns></returns> public static EventBusOptions AddHandler <TEventHandler>(this EventBusOptions options, EventHandlerActivationType activationType) where TEventHandler : class, IEventHandler { options.AddHandler(EventHandlerDescriptor.Describe <TEventHandler>(activationType)); return(options); }
/// <summary> /// /// </summary> /// <param name="options"></param> /// <param name="handlerType"></param> /// <param name="activationType"></param> /// <returns></returns> public static EventBusOptions AddHandler(this EventBusOptions options, Type handlerType, EventHandlerActivationType activationType) { options.AddHandler(EventHandlerDescriptor.Describe(handlerType, activationType)); return(options); }