Merge pull request #1861 from saper/home-override
[mono-project.git] / mcs / tests / test-775.cs
blobfa8dc1ce20a942c726afa3db99b1c6ea308751e0
1 using System;
3 interface A
5 event EventHandler Member;
8 interface B : A
10 new event EventHandler Member;
13 interface BA : B, A { }
15 public class C : BA
17 public EventHandler _AMember;
18 public EventHandler _Member;
20 event EventHandler A.Member
22 add { _AMember += value; Console.WriteLine ("Setting A Event"); }
23 remove { _AMember -= value; }
26 public event EventHandler Member
28 add { _Member += value; Console.WriteLine ("Setting Direct Event"); }
29 remove { _Member -= value; }
33 public class Test
35 public static int Main ()
37 return new Test ().TestMe ();
40 public int TestMe ()
42 C c = new C ();
43 Console.WriteLine ("Trying to set EventHandler Directly - should set DirectEvent ");
44 c.Member += new EventHandler (f);
45 if (c._Member == null)
46 return 0;
48 c._Member = null;
49 Console.WriteLine ("Trying to set EventHandler through A interface - Should set A Event");
50 ((A) c).Member += new EventHandler (f);
51 if (c._AMember == null)
52 return 1;
54 c._AMember = null;
55 Console.WriteLine ("Trying to set EventHandler through BA interface - Should set Direct Event");
56 ((BA) c).Member += new EventHandler (f);
57 if (c._Member == null)
58 return 2;
60 Console.WriteLine ("ok");
61 return 0;
64 void f (object sender, EventArgs e) { }