Skip to content

Moq1200 incorrectly firing on overridable member #143

@rjmurillo

Description

@rjmurillo

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.

Metadata

Metadata

Assignees

Labels

.NETPull requests that update .net codeanalyzersChange that impacts an analyzer behaviorbug

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions