Beispiel #1
0
 public void TestColumnClass_FirstField_InvokeMethods()
 {
     PropertyInfo firstFieldProperty = (typeof(ColumnClass)).GetProperty("FirstField");
     MethodInfo getFirstFieldProperty = (typeof(ColumnClass)).GetMethod("get_FirstField");
     ColumnClass instance = new ColumnClass() { FirstField = 2 };
     int result = (int)getFirstFieldProperty.Invoke(instance, new object[] { });
     Assert.AreEqual(result, 2);
     result = (int)firstFieldProperty.GetValue(instance, null);
     Assert.AreEqual(result, 2);
     object result2 = firstFieldProperty.GetValue(instance, null);
     Assert.AreEqual(result2, 2);
 }
Beispiel #2
0
 public void TestColumnClass_SetFirstField_InvokeMethods()
 {
     PropertyInfo firstFieldProperty = (typeof(ColumnClass)).GetProperty("FirstField");
     ColumnClass instance = new ColumnClass();
     firstFieldProperty.SetValue(instance, 2, null);
     Assert.AreEqual(instance.FirstField, 2);
     MethodInfo parseMethod = firstFieldProperty.PropertyType.GetParseMethod();
     firstFieldProperty.SetValue(instance, parseMethod.Invoke(
         firstFieldProperty.PropertyType, new object[] { "3" }), null);
     Assert.AreEqual(instance.FirstField, 3);
 }