diff --git a/Source/MatcherFactory.cs b/Source/MatcherFactory.cs index db8463458..2ae048921 100644 --- a/Source/MatcherFactory.cs +++ b/Source/MatcherFactory.cs @@ -99,19 +99,19 @@ public static IMatcher CreateMatcher(Expression expression, bool isParams) if (attr != null) { var matcher = attr.CreateMatcher(); - matcher.Initialize(expression); + matcher.Initialize(originalExpression); return matcher; } else if (staticMatcherMethodAttr != null) { var matcher = new MatcherAttributeMatcher(); - matcher.Initialize(expression); + matcher.Initialize(originalExpression); return matcher; } else { var matcher = new LazyEvalMatcher(); - matcher.Initialize(expression); + matcher.Initialize(originalExpression); return matcher; } } diff --git a/UnitTests/Regressions/IssueReportsFixture.cs b/UnitTests/Regressions/IssueReportsFixture.cs index f237ceb21..676a36860 100644 --- a/UnitTests/Regressions/IssueReportsFixture.cs +++ b/UnitTests/Regressions/IssueReportsFixture.cs @@ -1889,5 +1889,25 @@ public interface IServiceContract #endif #endregion + + #region Matcher should work with Convert + + public class MatcherConvertFixture + { + public interface IFoo + { + string M(long l); + } + + [Fact] + public void MatcherDoesNotIgnoreConvert() + { + var mock = new Mock(MockBehavior.Strict); + mock.Setup(x => x.M(int.Parse("2"))).Returns("OK"); + Assert.Equal("OK", mock.Object.M(2L)); + } + } + + #endregion } }