public void GenericCallUtilityTestsSimplePasses() { var s = new Sample(); { var mi = s.GetType().GetMethod("Set"); var action = GenericInvokeCallFactory.OpenAction <Sample, int>(mi); action(s, 1); Assert.AreEqual(1, s.Value); } { var mi = s.GetType().GetMethod("Get"); var func = GenericInvokeCallFactory.OpenFunc <Sample, int, int>(mi); /*var value =*/ func(s, 1); Assert.AreEqual(1, s.Value); } { var mi = s.GetType().GetMethod("Set"); var action = GenericExpressionCallFactory.Create <Sample, int>(mi); action(s, 2); Assert.AreEqual(2, s.Value); } }
public void GenericCallUtilityTestsSimplePasses() { var s = new Sample(); var mi = s.GetType().GetMethod("Set"); var invoke = (Action <Sample, int>)GenericInvokeCallFactory.Create <Sample, int>(mi); invoke(s, 1); Assert.AreEqual(1, s.Value); var exp = (Action <Sample, int>)GenericExpressionCallFactory.Create <Sample, int>(mi); exp(s, 2); Assert.AreEqual(2, s.Value); }