Пример #1
0
        public void IsMatch_ReferenceTypeTargetEqualToActualButNotSame_ReturnsFalse()
        {
            var expression = Expression.Constant(1);

            SetupExpressionValue(expression, "aaa");

            var subject = new TargetMatcher(_expressionHelperMock.Object, _itIsMatcherMock.Object);
            var result  = subject.IsMatch(typeof(string), expression, new string('a', 3));

            Assert.IsFalse(result);
        }
Пример #2
0
        public void IsMatch_ValueTypeTargetUnequalToActual_ReturnsFalse()
        {
            var expression = Expression.Constant(1);

            SetupExpressionValue(expression, 1000);

            var subject = new TargetMatcher(_expressionHelperMock.Object, _itIsMatcherMock.Object);
            var result  = subject.IsMatch(typeof(int), expression, 42);

            Assert.IsFalse(result);
        }
Пример #3
0
        public void IsMatch_ReferenceTypeTargetSameAsActual_ReturnsTrue()
        {
            const string value = "aaa";

            var expression = Expression.Constant(1);

            SetupExpressionValue(expression, value);

            var subject = new TargetMatcher(_expressionHelperMock.Object, _itIsMatcherMock.Object);
            var result  = subject.IsMatch(typeof(string), expression, value);

            Assert.IsTrue(result);
        }
Пример #4
0
        public void IsMatch_IsUnconditionalAny_ReturnsTrue()
        {
            var expression = Expression.Constant(1);

            _expressionHelperMock
            .Setup(helper => helper.IsMethodInvocation(expression, "It", "IsAny", 0))
            .Returns(true);

            var subject = new TargetMatcher(_expressionHelperMock.Object, _itIsMatcherMock.Object);
            var result  = subject.IsMatch(typeof(object), expression, 42);

            Assert.IsTrue(result);
        }