[System.Windows.Forms] Disable failing test
[mono-project.git] / mcs / tests / dtest-008.cs
blob9039c1f09002342be383d112e1e43f964ffee5c7
1 using System;
2 using System.Collections.Generic;
4 // Dynamic statements
6 class Disposable : IDisposable
8 public static int Counter;
10 public void Dispose ()
12 ++Counter;
15 public void Test ()
20 public class Test
22 bool ForEachTest ()
24 dynamic d = new List<int> { 5, 10, 7 };
25 dynamic res = 9;
26 foreach (var v in d) {
27 res += v;
30 return res == 31;
33 bool ForEachTest_2()
35 dynamic c = new int [] { 5, 7 };
36 int total = 0;
37 foreach (var v in c)
39 total += v;
42 return total == 12;
45 bool ForEachTest_3()
47 dynamic[] c = new dynamic [] { (byte) 1, 7 };
48 int total = 0;
49 foreach (var v in c)
51 total += v;
54 Console.WriteLine (total);
55 return total == 8;
58 bool UsingTest ()
60 dynamic d = new Disposable ();
61 try {
62 using (d) {
63 d.VV ();
65 } catch { }
67 if (Disposable.Counter != 1)
68 return false;
70 try {
71 using (dynamic u = new Disposable ()) {
72 u.VV ();
74 } catch { }
76 if (Disposable.Counter != 2)
77 return false;
79 using (dynamic u = new Disposable ()) {
80 u.Test ();
83 return true;
86 public static int Main ()
88 var t = new Test ();
89 if (!t.ForEachTest ())
90 return 1;
92 if (!t.ForEachTest_2 ())
93 return 2;
95 if (!t.ForEachTest_3 ())
96 return 3;
98 if (!t.UsingTest ())
99 return 10;
101 Console.WriteLine ("ok");
102 return 0;