* MSBuild.cs (Execute): Don't share target output items,
[mcs.git] / tests / dtest-001.cs
blob1e20c069828342ab1187b7d17013cc9b73ff4497
1 //
2 // dynamic type attribute decoration
3 //
5 using System;
7 class C
9 public C (dynamic d)
13 public dynamic a;
14 public dynamic[] a2;
15 public const dynamic c = default (dynamic);
17 public dynamic Prop { set; get; }
18 public dynamic Prop2 { set {} }
20 public dynamic this [dynamic d] { set {} get { return 1; } }
22 public dynamic Method (dynamic d)
24 return null;
28 delegate dynamic Del (dynamic d);
30 class Test
32 public static int Main ()
34 Type t = typeof (C);
35 Type ca = typeof (System.Runtime.CompilerServices.DynamicAttribute);
37 if (t.GetMember ("a")[0].GetCustomAttributes (ca, false).Length != 1)
38 return 1;
40 // TODO: Why is it needed
41 //if (t.GetMember ("a2")[0].GetCustomAttributes (ca, false).Length != 1)
42 // return 2;
44 if (t.GetMember ("c")[0].GetCustomAttributes (ca, false).Length != 1)
45 return 3;
47 if (t.GetMember ("Prop")[0].GetCustomAttributes (ca, false).Length != 1)
48 return 4;
50 if (t.GetMember ("get_Prop")[0].GetCustomAttributes (ca, false).Length != 0)
51 return 5;
53 if (t.GetMethod ("get_Prop").ReturnParameter.GetCustomAttributes (ca, false).Length != 1)
54 return 6;
56 if (t.GetMember ("set_Prop")[0].GetCustomAttributes (ca, false).Length != 0)
57 return 7;
59 if (t.GetMethod ("set_Prop").ReturnParameter.GetCustomAttributes (ca, false).Length != 0)
60 return 8;
62 if (t.GetMethod ("set_Prop").GetParameters()[0].GetCustomAttributes (ca, false).Length != 1)
63 return 9;
65 if (t.GetMember ("Prop2")[0].GetCustomAttributes (ca, false).Length != 1)
66 return 10;
68 if (t.GetMember ("set_Prop2")[0].GetCustomAttributes (ca, false).Length != 0)
69 return 11;
71 if (t.GetMember ("Item")[0].GetCustomAttributes (ca, false).Length != 1)
72 return 12;
74 if (t.GetMethod ("get_Item").ReturnParameter.GetCustomAttributes (ca, false).Length != 1)
75 return 13;
77 if (t.GetMethod ("get_Item").GetParameters()[0].GetCustomAttributes (ca, false).Length != 1)
78 return 14;
80 if (t.GetMethod ("set_Item").ReturnParameter.GetCustomAttributes (ca, false).Length != 0)
81 return 15;
83 if (t.GetMethod ("set_Item").GetParameters()[0].GetCustomAttributes (ca, false).Length != 1)
84 return 16;
86 if (t.GetMethod ("set_Item").GetParameters()[1].GetCustomAttributes (ca, false).Length != 1)
87 return 17;
89 if (t.GetMember ("Method")[0].GetCustomAttributes (ca, false).Length != 0)
90 return 18;
92 if (t.GetMethod ("Method").GetParameters()[0].GetCustomAttributes (ca, false).Length != 1)
93 return 19;
95 if (t.GetConstructors ()[0].GetParameters()[0].GetCustomAttributes (ca, false).Length != 1)
96 return 20;
98 if (t.GetConstructors ()[0].GetCustomAttributes (ca, false).Length != 0)
99 return 21;
102 t = typeof (Del);
104 if (t.GetMember ("Invoke")[0].GetCustomAttributes (ca, false).Length != 0)
105 return 100;
107 if (t.GetMethod ("Invoke").GetParameters()[0].GetCustomAttributes (ca, false).Length != 1)
108 return 101;
110 if (t.GetMethod ("Invoke").ReturnParameter.GetCustomAttributes (ca, false).Length != 1)
111 return 102;
113 Console.WriteLine ("ok");
114 return 0;