コード例 #1
0
        public void ShouldTriggerOnTotalMisusageWithObjectEquals_Left()
        {
            var hint = new TimeSpanTotalMistakesHint();

            Expression <Func <bool> > x = () => Equals(TimeSpan.FromMinutes(63).Minutes, 63);
            var p = new ExpressionParser(x.Body);

            string description;

            Assert.IsTrue(hint.TryGetHint(p, x.Body, out description));
            Assert.IsNotNull(description);
        }
コード例 #2
0
        public void DoesntExplodeOnNonTotalMethods()
        {
            var hint = new TimeSpanTotalMistakesHint();

            Expression <Func <bool> > x = () => Equals(TimeSpan.FromMinutes(63).Ticks, 63);
            var p = new ExpressionParser(x.Body);

            string description;

            Assert.IsFalse(hint.TryGetHint(p, x.Body, out description));
            Assert.IsNull(description);
        }
コード例 #3
0
        public void DoesntTriggerIfTheyWouldNotBeEqual()
        {
            var hint = new TimeSpanTotalMistakesHint();

            Expression <Func <bool> > x = () => Equals(TimeSpan.FromMinutes(63).Minutes, 62);
            var p = new ExpressionParser(x.Body);

            string description;

            Assert.IsFalse(hint.TryGetHint(p, x.Body, out description));
            Assert.IsNull(description);
        }