/// <summary> /// Handles the subscriber. /// </summary> /// <param name="subscriber">The subscriber.</param> /// <param name="register">true to register subscriptions, false to unregister them.</param> /// <param name="methodInfo">The handler method.</param> /// <param name="attr">The subscription attribute.</param> /// <param name="eventTopicHost">The event topic host.</param> private void HandleSubscriber( object subscriber, bool register, MethodInfo methodInfo, EventSubscriptionAttribute attr, IEventTopicHost eventTopicHost) { IEventTopic topic = eventTopicHost.GetEventTopic(attr.Topic); if (register) { List <ISubscriptionMatcher> matchers = new List <ISubscriptionMatcher>(); foreach (Type type in attr.MatcherTypes) { matchers.Add(this.factory.CreateSubscriptionMatcher(type)); } topic.AddSubscription( subscriber, methodInfo, this.factory.CreateHandler(attr.HandlerType), matchers); } else { topic.RemoveSubscription(subscriber, methodInfo); } }
public void EventNameIsStored() { EventSubscriptionAttribute attr = new EventSubscriptionAttribute("MyEvent"); Assert.AreEqual("MyEvent", attr.Topic); }
public void EventhandlerAttributeIsAvailable() { EventSubscriptionAttribute attr = new EventSubscriptionAttribute("MyEvent"); Assert.IsNotNull(attr); }