You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I ran into an issue when I was (unwittingly) attempting to mock an extension method. I've seen #189, and I understand why I can't do that. Still, I think the error messaging could be better.
I have an interface:
public interface ILogger
{
void Error(string);
}
and an extension method:
public void Error(this ILogger logger, Exception e)
{
...
}
and a test
[TestMethod]
public void TestIt()
{
var logger = new Mock<ILogger>();
logger.Verify(l => l.Error(It.IsAny<Exception>()));
}
As expected, the test fails. But why the test fails is confusing. The following error is returned:
Invalid verify on a non-virtual (overridable in VB) member: l => l.Error(It.IsAny())
The error says nothing about how Error(Exception) isn't even a member of ILogger.
The text was updated successfully, but these errors were encountered:
I ran into an issue when I was (unwittingly) attempting to mock an extension method. I've seen #189, and I understand why I can't do that. Still, I think the error messaging could be better.
I have an interface:
and an extension method:
and a test
As expected, the test fails. But why the test fails is confusing. The following error is returned:
The error says nothing about how
Error(Exception)
isn't even a member ofILogger
.The text was updated successfully, but these errors were encountered: