public void CanRegisterLocalEventPublisher() { EventInspector.Register(new Mocks.LocalEventPublisher(), workItem); Assert.AreEqual(1, workItem.EventTopics.Count); Assert.AreEqual("LocalEvent", workItem.EventTopics.Get("LocalEvent").Name); Assert.AreEqual(1, workItem.EventTopics.Get("LocalEvent").PublicationCount); }
protected virtual void OnCreatedChannel(object sender, EventArgs <IChannel> e) { if (CreatedChannel != null) { EventInspector.Register(e.Data, workItem); CreatedChannel(sender, e); } }
public void CanRegisterGlobalEventPublisher() { EventTopic handle = new EventTopic(); EventInspector.Register(new Mocks.GlobalEventPublisher(), workItem); Assert.AreEqual(1, workItem.EventTopics.Count); Assert.AreEqual("GlobalEvent", workItem.EventTopics.Get("GlobalEvent").Name); Assert.AreEqual(1, workItem.EventTopics.Get("GlobalEvent").PublicationCount); }
/// <summary> /// Forwards the <see cref="EventTopic"/> related attributes processing to the <see cref="EventInspector"/> /// for registering publishers and/or subscribers. /// </summary> public override object BuildUp(IBuilderContext context, Type t, object existing, string id) { WorkItem workItem = GetWorkItem(context, existing); if (workItem != null) { EventInspector.Register(existing, workItem); } return(base.BuildUp(context, t, existing, id)); }
public void EmptyTopicsGetsUnregistered() { EventTopic topic = new EventTopic(); workItem.EventTopics.Add(topic, "GlobalEvent"); Mocks.GlobalEventPublisher publisher = new Mocks.GlobalEventPublisher(); Mocks.GlobalEventHandler subscriber = new Mocks.GlobalEventHandler(); EventInspector.Register(publisher, workItem); Assert.AreEqual(1, topic.PublicationCount); EventInspector.Register(subscriber, workItem); Assert.AreEqual(1, topic.SubscriptionCount); EventInspector.Unregister(publisher, workItem); Assert.AreEqual(0, topic.PublicationCount); Assert.AreEqual(1, topic.SubscriptionCount); EventInspector.Unregister(subscriber, workItem); Assert.AreEqual(0, topic.PublicationCount); Assert.AreEqual(0, topic.SubscriptionCount); }
public void CanRegisterObject() { EventInspector.Register(new object(), workItem); Assert.AreEqual(0, workItem.EventTopics.Count); }
public void CannotRegisterNullObject() { EventInspector.Register(null, workItem); }
public void CanRegisterObjectWithOverloadedMethodes() { EventInspector.Register(new subA(), workItem); Assert.AreEqual(1, workItem.EventTopics.Count); }