public void EventNameAndWorkItemAreStored() { EventPublicationAttribute attr = new EventPublicationAttribute("MyEvent", PublicationScope.WorkItem); Assert.AreEqual("MyEvent", attr.Topic); Assert.AreEqual(PublicationScope.WorkItem, attr.Scope); }
public void EventSourceAttributeIsAvailable() { EventPublicationAttribute attr = new EventPublicationAttribute("MyEvent"); Assert.IsNotNull(attr); Assert.AreEqual(PublicationScope.Global, attr.Scope); }
/// <summary> /// Handles the publisher. /// </summary> /// <param name="publisher">The publisher.</param> /// <param name="register">true to register publications, false to unregister them.</param> /// <param name="eventInfo">The published event..</param> /// <param name="attr">The attribute</param> /// <param name="eventTopicHost">The event topic host.</param> private void HandlePublisher( object publisher, bool register, EventInfo eventInfo, EventPublicationAttribute attr, IEventTopicHost eventTopicHost) { IEventTopic topic = eventTopicHost.GetEventTopic(attr.Topic); if (register) { List <IPublicationMatcher> matchers = new List <IPublicationMatcher>(); foreach (Type type in attr.MatcherTypes) { matchers.Add(this.factory.CreatePublicationMatcher(type)); } topic.AddPublication( publisher, eventInfo, attr.HandlerRestriction, matchers); } else { topic.RemovePublication(publisher, eventInfo); } }
public void EventNameIsStored() { EventPublicationAttribute attr = new EventPublicationAttribute("MyEvent"); Assert.AreEqual("MyEvent", attr.Topic); }