moq.analyzers icon indicating copy to clipboard operation
moq.analyzers copied to clipboard

Moq1200 incorrectly firing on overridable member

Open rjmurillo opened this issue 7 months ago • 0 comments

Analyzer Moq1200 is incorrectly firing in the following case

public interface IFoo
{
  Task<bool> DoSomethingAsync();
}

var mock = new Mock<IFoo>();
mock.Setup(foo => foo.DoSomethingAsync().Result).Returns(true);

The analyzer indicates the Setup should be used only for overridable members; however, this member is on an interface while the error only makes sense if the method is on a class.

rjmurillo avatar Jul 06 '24 20:07 rjmurillo