示例#1
0
        public void TestHasClosureReferenceClassMethod()
        {
            var          target = new TestClass();
            Action <int> action = target.SetValue;

            Assert.That(OpenAction.HasClosureReference(action), Is.False);
        }
示例#2
0
        public void TestHasClosureReferenceClassMethodLambda()
        {
            var          target = new TestClass();
            Action <int> action = i => target.SetValue(i + 1);

            Assert.That(OpenAction.HasClosureReference(action), Is.True);
        }
示例#3
0
        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
        }
示例#4
0
        public void TestHasClosureReferenceThisMethodLambda()
        {
            Action <int> action = i => LocalMethod(i + 1);

            Assert.That(OpenAction.HasClosureReference(action), Is.False);
        }
示例#5
0
        public void TestHasClosureReferenceStaticMethodLambda()
        {
            Action <int> action = i => TestClass.SetStaticValue(i + 1);

            Assert.That(OpenAction.HasClosureReference(action), Is.False);
        }