[System.Windows.Forms] Disable failing test
[mono-project.git] / mcs / tests / gtest-autoproperty-03.cs
blob2b48661f53923066ef52f1fd15ed5495a815d817
2 // Make sure that the field and accessor methods of an automatic property have the CompilerGenerated attribute
3 using System;
4 using System.Reflection;
5 using System.Runtime.CompilerServices;
6 using System.Diagnostics;
8 public class Test
10 public string Foo { get; set; }
12 public static int Main ()
14 FieldInfo [] fields = typeof (Test).GetFields(BindingFlags.NonPublic | BindingFlags.Instance);
15 if (!(fields.Length > 0))
16 return 1;
17 object [] field_atts = fields[0].GetCustomAttributes (false);
18 if (field_atts.Length != 2)
19 return 2;
20 if (field_atts[1].GetType() != typeof (DebuggerBrowsableAttribute))
21 return 3;
22 if (field_atts[0].GetType() != typeof (CompilerGeneratedAttribute))
23 return 4;
25 if (fields [0].Name != "<Foo>k__BackingField")
26 return 10;
28 PropertyInfo property = typeof (Test).GetProperty ("Foo");
29 MethodInfo get = property.GetGetMethod (false);
30 object [] get_atts = get.GetCustomAttributes (false);
31 if (!(get_atts.Length > 0))
32 return 4;
33 if (get_atts[0].GetType() != typeof (CompilerGeneratedAttribute))
34 return 5;
36 MethodInfo set = property.GetSetMethod (false);
37 object [] set_atts = set.GetCustomAttributes (false);
38 if (!(set_atts.Length > 0))
39 return 6;
40 if (set_atts[0].GetType() != typeof (CompilerGeneratedAttribute))
41 return 7;
43 return 0;