Beispiel #1
0
 public void TestInvokeInstanceMethodViaMethodInfo()
 {
     RunWith((object person) => {
         double[] elements = new[] { 1d, 2d, 3d, 4d, 5d };
         System.Reflection.MethodInfo methodInfo = person.UnwrapIfWrapped().GetType().Method("Walk", new[] { typeof(int) }, FasterflectFlags.InstanceAnyVisibility);
         elements.ForEach(element => methodInfo.Call(person, element));
         Assert.AreEqual(elements.Sum(), person.GetFieldValue("metersTravelled"));
     });
 }