Ejemplo n.º 1
0
        public void EventWithInternalEventHandler()
        {
            var  eventSource  = new MockEventSource();
            var  eventHandler = new MockInternalEventHandler();
            var  eventArgs    = new EventArgs();
            bool eventRaised  = false;

            eventHandler.Action = (s, e) =>
            {
                Assert.AreSame(eventSource, s);
                Assert.AreSame(eventArgs, e);
                eventRaised = true;
            };

            eventSource.MyEvent += eventHandler.OnEvent;
            eventSource.RaiseMyEvent(eventArgs);
            Assert.IsTrue(eventRaised);
        }
Ejemplo n.º 2
0
    public void EventWithInternalEventHandler()
    {
      var eventSource = new MockEventSource();
      var eventHandler = new MockInternalEventHandler();
      var eventArgs = new EventArgs();
      bool eventRaised = false;

      eventHandler.Action = (s, e) =>
      {
        Assert.AreSame(eventSource, s);
        Assert.AreSame(eventArgs, e);
        eventRaised = true;
      };

      eventSource.MyEvent += eventHandler.OnEvent;
      eventSource.RaiseMyEvent(eventArgs);
      Assert.IsTrue(eventRaised);
    }