示例#1
0
        public void testEventHandler()
        {
            var flag = false;
            var flag2 = false;
            AssertFalse("flag must not yet be set", flag);
            AssertFalse("flag2 must not yet be set", flag2);

            var tester = new EventTester();
            tester.MyEvent += (s, x) => { flag = true; };
            tester.MyEvent += (s, x) => { flag2 = true; };
            tester.OnMyEvent();
			
            AssertTrue("flag must be set", flag);
            AssertTrue("flag2 must be set", flag2);
        }
示例#2
0
        public void testEventHandlerT()
        {
            var flag  = false;
            var flag2 = false;

            AssertFalse("flag must not yet be set", flag);
            AssertFalse("flag2 must not yet be set", flag2);

            var tester = new EventTester <EventArgs>();

            tester.MyEvent += (s, x) => { flag = true; };
            tester.MyEvent += (s, x) => { flag2 = true; };
            tester.OnMyEvent(EventArgs.Empty);

            AssertTrue("flag must be set", flag);
            AssertTrue("flag2 must be set", flag2);
        }
示例#3
0
        public void testEventHandler2()
        {
            var flag  = false;
            var flag2 = false;

            AssertFalse("flag must not yet be set", flag);
            AssertFalse("flag2 must not yet be set", flag2);

            var          tester  = new EventTester();
            EventHandler handler = (s, x) => { flag = true; };

            tester.MyEvent += handler;
            tester.MyEvent += (s, x) => { flag2 = true; };
            tester.MyEvent -= handler;
            tester.OnMyEvent();

            AssertFalse("flag must not be set", flag);
            AssertTrue("flag2 must be set", flag2);
        }