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); }
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); }
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); }