public void TestCreateAction2b() { string n = nameof(ExampleClass2.Increment); Action2 inc = Accelerator.CreateAction2(typeof(ExampleClass2).GetMethod(n, new[] { typeof(int) })); var o = new ExampleClass2(); o.Increment(1); Assert.AreEqual(1, o.Value); inc(o, 3); Assert.AreEqual(4, o.Value); inc(o, 11); Assert.AreEqual(15, o.Value); }
public void TestCreateAction1b() { string n = nameof(ExampleClass2.Increment); Action1 inc = Accelerator.CreateAction1(typeof(ExampleClass2).GetMethod(n, Type.EmptyTypes)); var o = new ExampleClass2(); o.Increment(); Assert.AreEqual(1, o.Value); inc(o); Assert.AreEqual(2, o.Value); inc(o); inc(o); Assert.AreEqual(4, o.Value); }