[Microsoft.Build] Ignore ThreadAbortException in BuildNodeManager
[mono-project.git] / mono / tests / bug-400716.cs
blobe655f061388aef537cc25cd64c7c91d1ed51ce32
1 using System;
2 using System.Collections.Generic;
3 using System.Linq;
5 namespace Repro {
6 public enum Bla {
7 A,B
10 class Driver {
12 static void TestEnumerator<K, T> ()
14 object obj = new K[10];
15 IEnumerable<T> dd = (IEnumerable<T>)obj;
16 var tx = dd.GetEnumerator ();
17 IEnumerator<T> x = (IEnumerator<T>)tx;
18 x.MoveNext ();
19 T t = x.Current;
22 static void TestBadEnumerator<K, T> ()
24 try {
25 object obj = new K[10];
26 IEnumerable<T> dd = (IEnumerable<T>)obj;
27 var tx = dd.GetEnumerator ();
28 IEnumerator<T> x = (IEnumerator<T>)tx;
29 x.MoveNext ();
30 T t = x.Current;
31 throw new Exception (string.Format ("An InvalidCastException should be thrown for {0} and {1}", typeof (K), typeof (T)));
32 } catch (InvalidCastException) {
37 public static int Main ()
39 TestEnumerator<byte, byte> ();
40 TestEnumerator<byte, sbyte> ();
41 TestEnumerator<sbyte, byte> ();
42 TestEnumerator<sbyte, sbyte> ();
44 TestEnumerator<int, int> ();
45 TestEnumerator<int, uint> ();
46 TestEnumerator<uint, int> ();
47 TestEnumerator<uint, uint> ();
49 TestEnumerator<Bla, Bla> ();
50 TestEnumerator<Bla, int> ();
52 TestEnumerator<byte[], byte[]> ();
53 TestEnumerator<byte[], sbyte[]> ();
54 TestEnumerator<byte[], ICollection<byte>> ();
55 TestEnumerator<byte[], IEnumerable<byte>> ();
56 TestEnumerator<byte[], IList<byte>> ();
57 TestEnumerator<byte[], ICollection<sbyte>> ();
58 TestEnumerator<byte[], IEnumerable<sbyte>> ();
59 TestEnumerator<byte[], IList<sbyte>> ();
60 TestEnumerator<byte[], object> ();
61 TestEnumerator<byte[], Array> ();
63 TestBadEnumerator<byte[], object[]> ();
64 TestBadEnumerator<byte[], byte> ();
65 TestBadEnumerator<byte[], sbyte> ();
66 TestBadEnumerator<byte[], ICollection<object>> ();
68 TestEnumerator<char[], char[]> ();
69 TestEnumerator<char[], IEnumerable<char>> ();
71 TestEnumerator<int[], IEnumerable<int>> ();
72 TestEnumerator<int[], IEnumerable<uint>> ();
74 return 0;