Merged into single file, added assertions
[mono.git] / mcs / tests / test-763.cs
1 using System;
2
3 public class StaticDelegateWithSameNameAsInstance
4 {
5         private Provider _provider;
6         delegate void Provider (string s);
7
8         Provider MyProvider
9         {
10                 set
11                 {
12                         _provider = value;
13                         if (_provider != null) {
14                                 _provider ("v");
15                         }
16                 }
17         }
18
19         static int i = 1;
20
21         public void StaticCallback ()
22         {
23                 i += 7;
24                 MyProvider = StaticCallback;
25         }
26
27         public static void StaticCallback (string s)
28         {
29                 if (s != "v")
30                         throw new ApplicationException ();
31
32                 i *= 3;
33         }
34
35         static int Main ()
36         {
37                 new StaticDelegateWithSameNameAsInstance ().StaticCallback ();
38
39                 Console.WriteLine (i);
40                 if (i != 24)
41                         return 1;
42
43                 return 0;
44         }
45 }