moq.analyzers
moq.analyzers copied to clipboard
Moq1200 incorrectly firing on overridable member
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.