eol
[mcs.git] / tests / test-30.cs
blob56c8308c02b914f60ea5be8367adccf214700b29
1 //
2 // Tests whether we implement the correct methods from interfaces
3 //
5 using System;
7 interface IA {
8 void Draw ();
11 interface IB {
12 void Draw ();
15 class X : IA, IB {
16 public bool ia_called;
17 public bool ib_called;
19 void IA.Draw ()
21 ia_called = true;
24 void IB.Draw ()
26 ib_called = true;
30 class test {
32 static int Main ()
34 X x = new X ();
36 ((IA) x).Draw ();
37 Console.WriteLine ("IA: " + x.ia_called);
38 Console.WriteLine ("IB: " + x.ib_called);
40 if (x.ib_called)
41 return 1;
42 if (!x.ia_called)
43 return 2;
45 X y = new X ();
46 ((IB) y).Draw ();
47 Console.WriteLine ("IA: " + x.ia_called);
48 Console.WriteLine ("IB: " + x.ib_called);
50 if (!y.ib_called)
51 return 3;
52 if (y.ia_called)
53 return 4;
55 Console.WriteLine ("All tests pass");
56 return 0;