public void ShouldBeTriggeredWithoutClosure_Right()
        {
            var hint = new DelegateShouldHaveBeenInvokedEqualsHint();

            Func<int> f = () => 3;

            Expression<Func<bool>> ex = () => Equals(3, f);

            string ignored;
            Assert.IsTrue(hint.TryGetHint(ex.Body, out ignored));
            Assert.IsNotNull(ignored);
        }
        public void ShouldNotBeTriggeredIfBothAreDelegates()
        {
            var hint = new DelegateShouldHaveBeenInvokedEqualsHint();

            Func<int> f = () => 3;

            Expression<Func<bool>> ex = () => Equals(f, f);

            string ignored;
            Assert.IsTrue(hint.TryGetHint(ex.Body, out ignored));

            Assert.IsTrue(ignored.Contains("suspicious"));
        }
        public void ShouldBeTriggeredWithClosure_Left()
        {
            var hint = new DelegateShouldHaveBeenInvokedEqualsHint();

            int n = 3;
            Func<int> f = () => n; // now this func requires a closure

            Expression<Func<bool>> ex = () => Equals(f, 3);

            string ignored;
            Assert.IsTrue(hint.TryGetHint(ex.Body, out ignored));
            Assert.IsNotNull(ignored);
        }
        public void ShouldNotBeTriggeredIfDelegateRequiresArgument()
        {
            var hint = new DelegateShouldHaveBeenInvokedEqualsHint();

            int n = 3;
            Func<int, int> f = _ => 3;

            Expression<Func<bool>> ex = () => Equals(f, n);
            var p = new ExpressionParser(ex.Body);

            string ignored;
            Assert.IsTrue(hint.TryGetHint(p, ex.Body, out ignored));

            Assert.IsTrue(ignored.Contains("suspicious"));
        }