コード例 #1
0
 public void BailsIfMethodDoesntExist () 
 {
     PingSource source = new PingSource ();
     InstanceEventHandlerValue wirer
         = new InstanceEventHandlerValue (source, "Roo");
     wirer.EventName = "Ping";
     wirer.Wire (source, typeof (StaticPingListener));
 }
コード例 #2
0
 public void BailsIfMethodDoesntExist () 
 {
     PingSource source = new PingSource ();
     InstanceEventHandlerValue wirer
         = new InstanceEventHandlerValue (source, "Roo");
     wirer.EventName = "Ping";
     Assert.Throws<FatalObjectException>(() => wirer.Wire (source, typeof (StaticPingListener)));
 }
コード例 #3
0
 public void WireWithStaticHandler () 
 {
     PingSource source = new PingSource ();
     InstanceEventHandlerValue wirer
         = new InstanceEventHandlerValue (source, "OnPing");
     wirer.EventName = "Ping";
     wirer.Wire (source, typeof (StaticPingListener));
 }
コード例 #4
0
        public void BailsIfMethodDoesntExist()
        {
            PingSource source = new PingSource();
            InstanceEventHandlerValue wirer
                = new InstanceEventHandlerValue(source, "Roo");

            wirer.EventName = "Ping";
            Assert.Throws <FatalObjectException>(() => wirer.Wire(source, typeof(StaticPingListener)));
        }
コード例 #5
0
        public void WireWithStaticHandler()
        {
            PingSource source = new PingSource();
            InstanceEventHandlerValue wirer
                = new InstanceEventHandlerValue(source, "OnPing");

            wirer.EventName = "Ping";
            wirer.Wire(source, typeof(StaticPingListener));
        }
コード例 #6
0
        public void BailsIfMethodDoesntExist()
        {
            PingSource source = new PingSource();
            InstanceEventHandlerValue wirer
                = new InstanceEventHandlerValue(source, "Roo");

            wirer.EventName = "Ping";
            wirer.Wire(source, typeof(StaticPingListener));
        }
コード例 #7
0
 public void Wire () {
     InstanceEventHandlerValue wirer = new InstanceEventHandlerValue ();
     wirer.EventName = "Ping";
     wirer.MethodName = "OnPing";
     PingSource source = new PingSource ();
     PingListener sink = new PingListener ();
     wirer.Wire (source, sink);
     source.OnPing ();
     Assert.IsTrue (sink.GotPing, "The event handler did not get notified when the event was raised.");
     Assert.AreEqual (1, sink.PingCount, "The event handler was not get notified exactly once when the event was raised exactly once.");
 }
コード例 #8
0
        public void Wire()
        {
            InstanceEventHandlerValue wirer = new InstanceEventHandlerValue();

            wirer.EventName  = "Ping";
            wirer.MethodName = "OnPing";
            PingSource   source = new PingSource();
            PingListener sink   = new PingListener();

            wirer.Wire(source, sink);
            source.OnPing();
            Assert.IsTrue(sink.GotPing, "The event handler did not get notified when the event was raised.");
            Assert.AreEqual(1, sink.PingCount, "The event handler was not get notified exactly once when the event was raised exactly once.");
        }