public void TestHasClosureReferenceClassMethod() { var target = new TestClass(); Action <int> action = target.SetValue; Assert.That(OpenAction.HasClosureReference(action), Is.False); }
public void TestHasClosureReferenceClassMethodLambda() { var target = new TestClass(); Action <int> action = i => target.SetValue(i + 1); Assert.That(OpenAction.HasClosureReference(action), Is.True); }
public void TestHasClosureReferenceLocalVariableLambda() { int value = 0; Action <int> action = i => value = i; Assert.That(OpenAction.HasClosureReference(action), Is.True); Assert.That(value, Is.EqualTo(0)); // prevent unused variable }
public void TestHasClosureReferenceThisMethodLambda() { Action <int> action = i => LocalMethod(i + 1); Assert.That(OpenAction.HasClosureReference(action), Is.False); }
public void TestHasClosureReferenceStaticMethodLambda() { Action <int> action = i => TestClass.SetStaticValue(i + 1); Assert.That(OpenAction.HasClosureReference(action), Is.False); }