public void Injector1TestWithLambdas2() { var predicate = GetFilter(); var injected = Injector1.Inject(predicate, () => PrintTrue(), null); var injectedDel = (Func <int, bool>)injected.Compile(); var injectResultTrue = injectedDel(12); Assert.IsTrue(injectResultTrue); Assert.IsTrue(result); var injectResultFalse = injectedDel(5); Assert.IsFalse(injectResultFalse); }
public void Injector1TestWithMethodInfo() { var miTrue = this.GetType().GetMethod("PrintTrue"); var miFalse = this.GetType().GetMethod("PrintFalse"); var predicate = GetFilter(); var injected = Injector1.Inject(predicate, this, miTrue, miFalse); var injectedDel = (Func <int, bool>)injected.Compile(); var injectResultTrue = injectedDel(12); Assert.IsTrue(injectResultTrue); Assert.IsTrue(result); var injectResultFalse = injectedDel(5); Assert.IsFalse(injectResultFalse); Assert.IsFalse(result); }