Esempio n. 1
0
        public void RaiseTest()
        {
            var a = new EventTester();

            a.RaiseA();
            a.RaiseB();
            a.RaiseC();
            a.RaiseD();
            a.RaiseE();
            Assert.AreEqual(0, a.eventCount);

            var b = new EventTester();

            b.Event1 += b.Target1;
            b.Event2 += b.Target2;
            b.Event3 += b.Target4;

            b.RaiseA();
            Assert.AreEqual(1, b.eventCount);
            b.eventCount = 0;

            b.RaiseB();
            Assert.AreEqual(1, b.eventCount);
            b.eventCount = 0;

            b.RaiseC();
            Assert.AreEqual(2, b.eventCount);
            b.eventCount = 0;

            b.RaiseE();
            Assert.AreEqual(4, b.eventCount);
            b.eventCount = 0;

            b.RaiseE();
            Assert.AreEqual(4, b.eventCount);
            b.eventCount = 0;
        }