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); }
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); }
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); }
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); }