Skip to content

Moq1002 false positive when using expression constructor #234

@MattKotsenas

Description

@MattKotsenas

This code fires Moq1002 when I believe that it shouldn't

_ = new Mock<Calculator>(() => new Calculator(), MockBehavior.Loose);

public class Calculator
{
    public int Add(int a, int b) => a + b;
}

Here's the overload that should be used: https://github.com/devlooped/moq/blob/18dc7410ad4f993ce0edd809c5dfcaa3199f13ff/src/Moq/Mock%601.cs#L200

Metadata

Metadata

Assignees

Labels

.NETPull requests that update .net codebug

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions