- 
                Notifications
    You must be signed in to change notification settings 
- Fork 3
Remove false positive for Moq1200 when using parameterized lambda #301
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
20c0af0
              4838e22
              accfc0a
              2a0edfd
              55acc3e
              c2584f6
              0d618c7
              File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| using Verifier = Moq.Analyzers.Test.Helpers.AnalyzerVerifier<Moq.Analyzers.ConstructorArgumentsShouldMatchAnalyzer>; | ||
| Check failure on line 1 in tests/Moq.Analyzers.Test/ConstructorArgumentsShouldMatchAnalyzerTests.Expressions.cs 
     | ||
|  | ||
| namespace Moq.Analyzers.Test; | ||
|  | ||
| public partial class ConstructorArgumentsShouldMatchAnalyzerTests | ||
| Check notice on line 5 in tests/Moq.Analyzers.Test/ConstructorArgumentsShouldMatchAnalyzerTests.Expressions.cs 
     | ||
| { | ||
| public static IEnumerable<object[]> ExpressionTestData() | ||
| { | ||
| return new object[][] | ||
| { | ||
| ["""_ = new Mock<Calculator>(() => new Calculator(), MockBehavior.Loose);"""], | ||
| ["""_ = new Mock<Calculator>(() => new Calculator(), MockBehavior.Strict);"""], | ||
| ["""_ = new Mock<Calculator>(() => new Calculator(), MockBehavior.Default);"""], | ||
| ["""_ = new Mock<Calculator>(() => new Calculator());"""], | ||
| }.WithNamespaces().WithMoqReferenceAssemblyGroups(); | ||
| } | ||
|  | ||
| [Theory] | ||
| [MemberData(nameof(ExpressionTestData))] | ||
| public async Task ShouldPassIfExpressionWithDefaultCtorIsUsedWithMockBehavior(string referenceAssemblyGroup, string @namespace, string mock) | ||
| { | ||
| await Verifier.VerifyAnalyzerAsync( | ||
| $@" | ||
| {@namespace} | ||
| public class Calculator | ||
| {{ | ||
| public int Add(int a, int b) => a + b; | ||
| }} | ||
| internal class UnitTest | ||
| {{ | ||
| private void Test() | ||
| {{ | ||
| {mock} | ||
| }} | ||
| }} | ||
| ", | ||
| referenceAssemblyGroup); | ||
| } | ||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.