Exemplo n.º 1
0
        public void TestInvoke_InvalidEventType()
        {
            DudSink s = new DudSink();

            s.BadEvent += () => { };
            s.InvokeEvent("BadEvent", EventArgs.Empty);
        }
Exemplo n.º 2
0
        public void TestInvoke_HandlerThrowsException_ThrowOnError()
        {
            DudSink s = new DudSink();

            s.ThrowOnInvocationFailure = true;
            s.TestEvent += (se, e) => { throw new Exception(); };
            s.InvokeEvent("TestEvent", this, EventArgs.Empty);
        }
Exemplo n.º 3
0
        public void TestInvoke_ValidSetup()
        {
            bool    didInvoke = false;
            DudSink s         = new DudSink();

            s.TestEvent += (se, e) => { didInvoke = true; };
            s.InvokeEvent("TestEvent", this, EventArgs.Empty);

            Assert.IsTrue(didInvoke);
        }
Exemplo n.º 4
0
        public void TestInvoke_HandlerThrowsException_DoNotThrowOnError()
        {
            bool    didInvoke = false;
            DudSink s         = new DudSink();

            s.ThrowOnInvocationFailure = false;
            s.TestEvent += (se, e) => { didInvoke = true; throw new Exception(); };
            s.InvokeEvent("TestEvent", this, EventArgs.Empty);

            Assert.IsTrue(didInvoke);
        }
Exemplo n.º 5
0
        public void TestInvoke_UnknownEvent()
        {
            EventSink s = new DudSink();

            s.InvokeEvent("DoesNotExist", this, EventArgs.Empty);
        }
Exemplo n.º 6
0
        public void TestInvoke_NullSender()
        {
            EventSink s = new DudSink();

            s.InvokeEvent("TestEvent", null, EventArgs.Empty);
        }
Exemplo n.º 7
0
        public void TestInvoke_EmptyEventName()
        {
            EventSink s = new DudSink();

            s.InvokeEvent(string.Empty, EventArgs.Empty);
        }
Exemplo n.º 8
0
        public void TestInvoke_NullEventName()
        {
            EventSink s = new DudSink();

            s.InvokeEvent(null, EventArgs.Empty);
        }