Inheritance: BaseInspector
コード例 #1
0
        public override System.Windows.Forms.Control CreatePartControl()
        {
            _pvc = new PortalViewControl();
            EventInspector.RegisterScenario(_pvc, Scenario);

            return(_pvc);
        }
コード例 #2
0
        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);
        }
コード例 #3
0
 protected virtual void OnCreatedChannel(object sender, EventArgs <IChannel> e)
 {
     if (CreatedChannel != null)
     {
         EventInspector.Register(e.Data, workItem);
         CreatedChannel(sender, e);
     }
 }
コード例 #4
0
        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);
        }
コード例 #5
0
        /// <summary>
        /// Forwards the <see cref="EventTopic"/> related attributes processing to the <see cref="EventInspector"/>
        /// for unregistering publishers and/or subscribers.
        /// </summary>
        public override object TearDown(IBuilderContext context, object item)
        {
            WorkItem workItem = GetWorkItem(context, item);

            if (workItem != null)
            {
                EventInspector.Unregister(item, workItem);
            }

            return(base.TearDown(context, item));
        }
コード例 #6
0
        /// <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));
        }
コード例 #7
0
        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);
        }
コード例 #8
0
        public void CanRegisterObject()
        {
            EventInspector.Register(new object(), workItem);

            Assert.AreEqual(0, workItem.EventTopics.Count);
        }
コード例 #9
0
 public void CannotRegisterNullObject()
 {
     EventInspector.Register(null, workItem);
 }
コード例 #10
0
        public void CanRegisterObjectWithOverloadedMethodes()
        {
            EventInspector.Register(new subA(), workItem);

            Assert.AreEqual(1, workItem.EventTopics.Count);
        }