From cc806451b7848af61ce7838492b2c9e97cd15c58 Mon Sep 17 00:00:00 2001 From: tpodolak Date: Fri, 9 Sep 2022 21:34:00 +0200 Subject: [PATCH] GH-153 - missing tests --- .../ForAsGenericMethodTests.cs | 8 ++--- .../ForAsNonGenericMethodTests.cs | 32 +++++-------------- .../ForPartsOfMethodTests.cs | 9 +++--- .../SubstituteFactoryCreateMethodTests.cs | 26 ++++----------- ...bstituteFactoryCreatePartialMethodTests.cs | 32 +++++-------------- ...stituteForInternalMemberCodeFixVerifier.cs | 25 +++++---------- .../ReturnsAsOrdinaryMethodTests.cs | 16 ++++++++++ .../ThrowsAsOrdinaryMethodTests.cs | 16 ++++++++++ .../ReceivedAsOrdinaryMethodTests.cs | 26 ++++++++++++++- .../ReceivedAsOrdinaryMethodTests.cs | 26 ++++++++++++++- .../ForAsGenericMethodTests.cs | 4 +++ .../ForPartsOfMethodTests.cs | 1 + .../ReceivedAsOrdinaryMethodTests.cs | 26 ++++++++++++++- .../CodeFixProviders/CodeFixVerifier.cs | 29 ++--------------- ...stituteForInternalMemberCodeFixVerifier.cs | 8 ++--- .../ForAsGenericMethodTests.cs | 9 +++--- .../ForAsNonGenericMethodTests.cs | 32 +++++-------------- .../ForPartsOfMethodTests.cs | 9 +++--- .../SubstituteFactoryCreateMethodTests.cs | 32 +++++-------------- ...bstituteFactoryCreatePartialMethodTests.cs | 32 +++++-------------- ...stituteForInternalMemberCodeFixVerifier.cs | 25 +++++---------- .../ReturnsAsOrdinaryMethodTests.cs | 18 +++++++++++ .../ThrowsAsOrdinaryMethodTests.cs | 18 +++++++++++ .../ReceivedAsOrdinaryMethodTests.cs | 26 ++++++++++++++- .../WhenAsOrdinaryMethodTests.cs | 2 ++ .../ReceivedAsOrdinaryMethodTests.cs | 25 ++++++++++++++- .../ReceivedAsOrdinaryMethodTests.cs | 25 ++++++++++++++- 27 files changed, 308 insertions(+), 229 deletions(-) diff --git a/tests/NSubstitute.Analyzers.Tests.CSharp/CodeFixProviderTests/SubstituteForInternalMemberCodeFixProviderTests/ForAsGenericMethodTests.cs b/tests/NSubstitute.Analyzers.Tests.CSharp/CodeFixProviderTests/SubstituteForInternalMemberCodeFixProviderTests/ForAsGenericMethodTests.cs index 234aaad7..1e5ee102 100644 --- a/tests/NSubstitute.Analyzers.Tests.CSharp/CodeFixProviderTests/SubstituteForInternalMemberCodeFixProviderTests/ForAsGenericMethodTests.cs +++ b/tests/NSubstitute.Analyzers.Tests.CSharp/CodeFixProviderTests/SubstituteForInternalMemberCodeFixProviderTests/ForAsGenericMethodTests.cs @@ -4,7 +4,7 @@ namespace NSubstitute.Analyzers.Tests.CSharp.CodeFixProviderTests.SubstituteForI public class ForAsGenericMethodTests : SubstituteForInternalMemberCodeFixVerifier { - public override async Task AppendsInternalsVisibleTo_ToTopLevelCompilationUnit_WhenUsedWithInternalClass(int diagnosticIndex) + public override async Task AppendsInternalsVisibleTo_ToTopLevelCompilationUnit_WhenUsedWithInternalClass() { var oldSource = @"using NSubstitute; namespace MyNamespace @@ -48,7 +48,7 @@ public void Test() await VerifyFix(oldSource, newSource); } - public override async Task AppendsInternalsVisibleTo_WhenUsedWithInternalClass(int diagnosticIndex) + public override async Task AppendsInternalsVisibleTo_WhenUsedWithInternalClass() { var oldSource = @"using NSubstitute; namespace MyNamespace @@ -86,7 +86,7 @@ public void Test() await VerifyFix(oldSource, newSource); } - public override async Task AppendsInternalsVisibleTo_WhenUsedWithInternalClass_AndArgumentListNotEmpty(int diagnosticIndex) + public override async Task AppendsInternalsVisibleTo_WhenUsedWithInternalClass_AndArgumentListNotEmpty() { var oldSource = @"using System.Reflection; using NSubstitute; @@ -127,7 +127,7 @@ public void Test() await VerifyFix(oldSource, newSource); } - public override async Task AppendsInternalsVisibleTo_WhenUsedWithNestedInternalClass(int diagnosticIndex) + public override async Task AppendsInternalsVisibleTo_WhenUsedWithNestedInternalClass() { var oldSource = @"using NSubstitute; namespace MyNamespace diff --git a/tests/NSubstitute.Analyzers.Tests.CSharp/CodeFixProviderTests/SubstituteForInternalMemberCodeFixProviderTests/ForAsNonGenericMethodTests.cs b/tests/NSubstitute.Analyzers.Tests.CSharp/CodeFixProviderTests/SubstituteForInternalMemberCodeFixProviderTests/ForAsNonGenericMethodTests.cs index 108ed0ff..b32c2310 100644 --- a/tests/NSubstitute.Analyzers.Tests.CSharp/CodeFixProviderTests/SubstituteForInternalMemberCodeFixProviderTests/ForAsNonGenericMethodTests.cs +++ b/tests/NSubstitute.Analyzers.Tests.CSharp/CodeFixProviderTests/SubstituteForInternalMemberCodeFixProviderTests/ForAsNonGenericMethodTests.cs @@ -4,7 +4,7 @@ namespace NSubstitute.Analyzers.Tests.CSharp.CodeFixProviderTests.SubstituteForI public class ForAsNonGenericMethodTests : SubstituteForInternalMemberCodeFixVerifier { - public override async Task AppendsInternalsVisibleTo_ToTopLevelCompilationUnit_WhenUsedWithInternalClass(int diagnosticIndex) + public override async Task AppendsInternalsVisibleTo_ToTopLevelCompilationUnit_WhenUsedWithInternalClass() { var oldSource = @"using NSubstitute; namespace MyNamespace @@ -20,8 +20,6 @@ public class FooTests public void Test() { var substitute = Substitute.For(new[] {typeof(Foo)}, null); - var otherSubstitute = Substitute.For(typesToProxy: new[] {typeof(Foo)}, constructorArguments: null); - var yetAnotherSubstitute = Substitute.For(constructorArguments: null, typesToProxy: new[] {typeof(Foo)}); } } } @@ -43,16 +41,14 @@ public class FooTests public void Test() { var substitute = Substitute.For(new[] {typeof(Foo)}, null); - var otherSubstitute = Substitute.For(typesToProxy: new[] {typeof(Foo)}, constructorArguments: null); - var yetAnotherSubstitute = Substitute.For(constructorArguments: null, typesToProxy: new[] {typeof(Foo)}); } } } }"; - await VerifyFix(oldSource, newSource, diagnosticIndex: diagnosticIndex); + await VerifyFix(oldSource, newSource); } - public override async Task AppendsInternalsVisibleTo_WhenUsedWithInternalClass(int diagnosticIndex) + public override async Task AppendsInternalsVisibleTo_WhenUsedWithInternalClass() { var oldSource = @"using NSubstitute; namespace MyNamespace @@ -66,8 +62,6 @@ public class FooTests public void Test() { var substitute = Substitute.For(new[] {typeof(Foo)}, null); - var otherSubstitute = Substitute.For(typesToProxy: new[] {typeof(Foo)}, constructorArguments: null); - var yetAnotherSubstitute = Substitute.For(constructorArguments: null, typesToProxy: new[] {typeof(Foo)}); } } }"; @@ -86,15 +80,13 @@ public class FooTests public void Test() { var substitute = Substitute.For(new[] {typeof(Foo)}, null); - var otherSubstitute = Substitute.For(typesToProxy: new[] {typeof(Foo)}, constructorArguments: null); - var yetAnotherSubstitute = Substitute.For(constructorArguments: null, typesToProxy: new[] {typeof(Foo)}); } } }"; - await VerifyFix(oldSource, newSource, diagnosticIndex: diagnosticIndex); + await VerifyFix(oldSource, newSource); } - public override async Task AppendsInternalsVisibleTo_WhenUsedWithInternalClass_AndArgumentListNotEmpty(int diagnosticIndex) + public override async Task AppendsInternalsVisibleTo_WhenUsedWithInternalClass_AndArgumentListNotEmpty() { var oldSource = @"using System.Reflection; using NSubstitute; @@ -110,8 +102,6 @@ public class FooTests public void Test() { var substitute = Substitute.For(new[] {typeof(Foo)}, null); - var otherSubstitute = Substitute.For(typesToProxy: new[] {typeof(Foo)}, constructorArguments: null); - var yetAnotherSubstitute = Substitute.For(constructorArguments: null, typesToProxy: new[] {typeof(Foo)}); } } }"; @@ -131,15 +121,13 @@ public class FooTests public void Test() { var substitute = Substitute.For(new[] {typeof(Foo)}, null); - var otherSubstitute = Substitute.For(typesToProxy: new[] {typeof(Foo)}, constructorArguments: null); - var yetAnotherSubstitute = Substitute.For(constructorArguments: null, typesToProxy: new[] {typeof(Foo)}); } } }"; - await VerifyFix(oldSource, newSource, diagnosticIndex: diagnosticIndex); + await VerifyFix(oldSource, newSource); } - public override async Task AppendsInternalsVisibleTo_WhenUsedWithNestedInternalClass(int diagnosticIndex) + public override async Task AppendsInternalsVisibleTo_WhenUsedWithNestedInternalClass() { var oldSource = @"using NSubstitute; namespace MyNamespace @@ -157,8 +145,6 @@ public class FooTests public void Test() { var substitute = Substitute.For(new[] {typeof(Foo.Bar)}, null); - var otherSubstitute = Substitute.For(typesToProxy: new[] {typeof(Foo.Bar)}, constructorArguments: null); - var yetAnotherSubstitute = Substitute.For(constructorArguments: null, typesToProxy: new[] {typeof(Foo.Bar)}); } } }"; @@ -181,12 +167,10 @@ public class FooTests public void Test() { var substitute = Substitute.For(new[] {typeof(Foo.Bar)}, null); - var otherSubstitute = Substitute.For(typesToProxy: new[] {typeof(Foo.Bar)}, constructorArguments: null); - var yetAnotherSubstitute = Substitute.For(constructorArguments: null, typesToProxy: new[] {typeof(Foo.Bar)}); } } }"; - await VerifyFix(oldSource, newSource, diagnosticIndex: diagnosticIndex); + await VerifyFix(oldSource, newSource); } public override async Task DoesNot_AppendsInternalsVisibleTo_WhenUsedWithPublicClass() diff --git a/tests/NSubstitute.Analyzers.Tests.CSharp/CodeFixProviderTests/SubstituteForInternalMemberCodeFixProviderTests/ForPartsOfMethodTests.cs b/tests/NSubstitute.Analyzers.Tests.CSharp/CodeFixProviderTests/SubstituteForInternalMemberCodeFixProviderTests/ForPartsOfMethodTests.cs index 2c72a2a4..6e67719c 100644 --- a/tests/NSubstitute.Analyzers.Tests.CSharp/CodeFixProviderTests/SubstituteForInternalMemberCodeFixProviderTests/ForPartsOfMethodTests.cs +++ b/tests/NSubstitute.Analyzers.Tests.CSharp/CodeFixProviderTests/SubstituteForInternalMemberCodeFixProviderTests/ForPartsOfMethodTests.cs @@ -4,7 +4,7 @@ namespace NSubstitute.Analyzers.Tests.CSharp.CodeFixProviderTests.SubstituteForI public class ForPartsOfMethodTests : SubstituteForInternalMemberCodeFixVerifier { - public override async Task AppendsInternalsVisibleTo_ToTopLevelCompilationUnit_WhenUsedWithInternalClass(int diagnosticIndex) + public override async Task AppendsInternalsVisibleTo_ToTopLevelCompilationUnit_WhenUsedWithInternalClass() { var oldSource = @"using NSubstitute; namespace MyNamespace @@ -48,7 +48,7 @@ public void Test() await VerifyFix(oldSource, newSource); } - public override async Task AppendsInternalsVisibleTo_WhenUsedWithInternalClass(int diagnosticIndex) + public override async Task AppendsInternalsVisibleTo_WhenUsedWithInternalClass() { var oldSource = @"using NSubstitute; namespace MyNamespace @@ -86,8 +86,7 @@ public void Test() await VerifyFix(oldSource, newSource); } - public override async Task AppendsInternalsVisibleTo_WhenUsedWithInternalClass_AndArgumentListNotEmpty( - int diagnosticIndex) + public override async Task AppendsInternalsVisibleTo_WhenUsedWithInternalClass_AndArgumentListNotEmpty() { var oldSource = @"using System.Reflection; using NSubstitute; @@ -128,7 +127,7 @@ public void Test() await VerifyFix(oldSource, newSource); } - public override async Task AppendsInternalsVisibleTo_WhenUsedWithNestedInternalClass(int diagnosticIndex) + public override async Task AppendsInternalsVisibleTo_WhenUsedWithNestedInternalClass() { var oldSource = @"using NSubstitute; namespace MyNamespace diff --git a/tests/NSubstitute.Analyzers.Tests.CSharp/CodeFixProviderTests/SubstituteForInternalMemberCodeFixProviderTests/SubstituteFactoryCreateMethodTests.cs b/tests/NSubstitute.Analyzers.Tests.CSharp/CodeFixProviderTests/SubstituteForInternalMemberCodeFixProviderTests/SubstituteFactoryCreateMethodTests.cs index 1a671367..6335b118 100644 --- a/tests/NSubstitute.Analyzers.Tests.CSharp/CodeFixProviderTests/SubstituteForInternalMemberCodeFixProviderTests/SubstituteFactoryCreateMethodTests.cs +++ b/tests/NSubstitute.Analyzers.Tests.CSharp/CodeFixProviderTests/SubstituteForInternalMemberCodeFixProviderTests/SubstituteFactoryCreateMethodTests.cs @@ -4,7 +4,7 @@ namespace NSubstitute.Analyzers.Tests.CSharp.CodeFixProviderTests.SubstituteForI public class SubstituteFactoryCreateMethodTests : SubstituteForInternalMemberCodeFixVerifier { - public override async Task AppendsInternalsVisibleTo_ToTopLevelCompilationUnit_WhenUsedWithInternalClass(int diagnosticIndex) + public override async Task AppendsInternalsVisibleTo_ToTopLevelCompilationUnit_WhenUsedWithInternalClass() { var oldSource = @"using NSubstitute.Core; namespace MyNamespace @@ -20,8 +20,6 @@ public class FooTests public void Test() { var substitute = SubstitutionContext.Current.SubstituteFactory.Create(new[] {typeof(Foo)}, null); - var otherSubstitute = SubstitutionContext.Current.SubstituteFactory.Create(typesToProxy: new[] {typeof(Foo)}, constructorArguments: null); - var yetAnotherSubstitute = SubstitutionContext.Current.SubstituteFactory.Create(constructorArguments: null, typesToProxy: new[] {typeof(Foo)}); } } } @@ -43,16 +41,14 @@ public class FooTests public void Test() { var substitute = SubstitutionContext.Current.SubstituteFactory.Create(new[] {typeof(Foo)}, null); - var otherSubstitute = SubstitutionContext.Current.SubstituteFactory.Create(typesToProxy: new[] {typeof(Foo)}, constructorArguments: null); - var yetAnotherSubstitute = SubstitutionContext.Current.SubstituteFactory.Create(constructorArguments: null, typesToProxy: new[] {typeof(Foo)}); } } } }"; - await VerifyFix(oldSource, newSource, diagnosticIndex: diagnosticIndex); + await VerifyFix(oldSource, newSource); } - public override async Task AppendsInternalsVisibleTo_WhenUsedWithInternalClass(int diagnosticIndex) + public override async Task AppendsInternalsVisibleTo_WhenUsedWithInternalClass() { var oldSource = @"using NSubstitute.Core; namespace MyNamespace @@ -90,7 +86,7 @@ public void Test() await VerifyFix(oldSource, newSource); } - public override async Task AppendsInternalsVisibleTo_WhenUsedWithInternalClass_AndArgumentListNotEmpty(int diagnosticIndex) + public override async Task AppendsInternalsVisibleTo_WhenUsedWithInternalClass_AndArgumentListNotEmpty() { var oldSource = @"using System.Reflection; using NSubstitute.Core; @@ -106,8 +102,6 @@ public class FooTests public void Test() { var substitute = SubstitutionContext.Current.SubstituteFactory.Create(new[] {typeof(Foo)}, null); - var otherSubstitute = SubstitutionContext.Current.SubstituteFactory.Create(typesToProxy: new[] {typeof(Foo)}, constructorArguments: null); - var yetAnotherSubstitute = SubstitutionContext.Current.SubstituteFactory.Create(constructorArguments: null, typesToProxy: new[] {typeof(Foo)}); } } }"; @@ -127,15 +121,13 @@ public class FooTests public void Test() { var substitute = SubstitutionContext.Current.SubstituteFactory.Create(new[] {typeof(Foo)}, null); - var otherSubstitute = SubstitutionContext.Current.SubstituteFactory.Create(typesToProxy: new[] {typeof(Foo)}, constructorArguments: null); - var yetAnotherSubstitute = SubstitutionContext.Current.SubstituteFactory.Create(constructorArguments: null, typesToProxy: new[] {typeof(Foo)}); } } }"; - await VerifyFix(oldSource, newSource, diagnosticIndex: diagnosticIndex); + await VerifyFix(oldSource, newSource); } - public override async Task AppendsInternalsVisibleTo_WhenUsedWithNestedInternalClass(int diagnosticIndex) + public override async Task AppendsInternalsVisibleTo_WhenUsedWithNestedInternalClass() { var oldSource = @"using NSubstitute.Core; namespace MyNamespace @@ -153,8 +145,6 @@ public class FooTests public void Test() { var substitute = SubstitutionContext.Current.SubstituteFactory.Create(new[] {typeof(Foo.Bar)}, null); - var otherSubstitute = SubstitutionContext.Current.SubstituteFactory.Create(typesToProxy: new[] {typeof(Foo.Bar)}, constructorArguments: null); - var yetAnotherSubstitute = SubstitutionContext.Current.SubstituteFactory.Create(constructorArguments: null, typesToProxy: new[] {typeof(Foo.Bar)}); } } }"; @@ -177,12 +167,10 @@ public class FooTests public void Test() { var substitute = SubstitutionContext.Current.SubstituteFactory.Create(new[] {typeof(Foo.Bar)}, null); - var otherSubstitute = SubstitutionContext.Current.SubstituteFactory.Create(typesToProxy: new[] {typeof(Foo.Bar)}, constructorArguments: null); - var yetAnotherSubstitute = SubstitutionContext.Current.SubstituteFactory.Create(constructorArguments: null, typesToProxy: new[] {typeof(Foo.Bar)}); } } }"; - await VerifyFix(oldSource, newSource, diagnosticIndex: diagnosticIndex); + await VerifyFix(oldSource, newSource); } public override async Task DoesNot_AppendsInternalsVisibleTo_WhenUsedWithPublicClass() diff --git a/tests/NSubstitute.Analyzers.Tests.CSharp/CodeFixProviderTests/SubstituteForInternalMemberCodeFixProviderTests/SubstituteFactoryCreatePartialMethodTests.cs b/tests/NSubstitute.Analyzers.Tests.CSharp/CodeFixProviderTests/SubstituteForInternalMemberCodeFixProviderTests/SubstituteFactoryCreatePartialMethodTests.cs index 22a8a375..e315d48e 100644 --- a/tests/NSubstitute.Analyzers.Tests.CSharp/CodeFixProviderTests/SubstituteForInternalMemberCodeFixProviderTests/SubstituteFactoryCreatePartialMethodTests.cs +++ b/tests/NSubstitute.Analyzers.Tests.CSharp/CodeFixProviderTests/SubstituteForInternalMemberCodeFixProviderTests/SubstituteFactoryCreatePartialMethodTests.cs @@ -4,7 +4,7 @@ namespace NSubstitute.Analyzers.Tests.CSharp.CodeFixProviderTests.SubstituteForI public class SubstituteFactoryCreatePartialMethodTests : SubstituteForInternalMemberCodeFixVerifier { - public override async Task AppendsInternalsVisibleTo_ToTopLevelCompilationUnit_WhenUsedWithInternalClass(int diagnosticIndex) + public override async Task AppendsInternalsVisibleTo_ToTopLevelCompilationUnit_WhenUsedWithInternalClass() { var oldSource = @"using NSubstitute.Core; namespace MyNamespace @@ -20,8 +20,6 @@ public class FooTests public void Test() { var substitute = SubstitutionContext.Current.SubstituteFactory.CreatePartial(new[] {typeof(Foo)}, null); - var otherSubstitute = SubstitutionContext.Current.SubstituteFactory.CreatePartial(typesToProxy: new[] {typeof(Foo)}, constructorArguments: null); - var yetAnotherSubstitute = SubstitutionContext.Current.SubstituteFactory.CreatePartial(constructorArguments: null, typesToProxy: new[] {typeof(Foo)}); } } } @@ -43,16 +41,14 @@ public class FooTests public void Test() { var substitute = SubstitutionContext.Current.SubstituteFactory.CreatePartial(new[] {typeof(Foo)}, null); - var otherSubstitute = SubstitutionContext.Current.SubstituteFactory.CreatePartial(typesToProxy: new[] {typeof(Foo)}, constructorArguments: null); - var yetAnotherSubstitute = SubstitutionContext.Current.SubstituteFactory.CreatePartial(constructorArguments: null, typesToProxy: new[] {typeof(Foo)}); } } } }"; - await VerifyFix(oldSource, newSource, diagnosticIndex: diagnosticIndex); + await VerifyFix(oldSource, newSource); } - public override async Task AppendsInternalsVisibleTo_WhenUsedWithInternalClass(int diagnosticIndex) + public override async Task AppendsInternalsVisibleTo_WhenUsedWithInternalClass() { var oldSource = @"using NSubstitute.Core; namespace MyNamespace @@ -66,8 +62,6 @@ public class FooTests public void Test() { var substitute = SubstitutionContext.Current.SubstituteFactory.CreatePartial(new[] {typeof(Foo)}, null); - var otherSubstitute = SubstitutionContext.Current.SubstituteFactory.CreatePartial(typesToProxy: new[] {typeof(Foo)}, constructorArguments: null); - var yetAnotherSubstitute = SubstitutionContext.Current.SubstituteFactory.CreatePartial(constructorArguments: null, typesToProxy: new[] {typeof(Foo)}); } } }"; @@ -86,15 +80,13 @@ public class FooTests public void Test() { var substitute = SubstitutionContext.Current.SubstituteFactory.CreatePartial(new[] {typeof(Foo)}, null); - var otherSubstitute = SubstitutionContext.Current.SubstituteFactory.CreatePartial(typesToProxy: new[] {typeof(Foo)}, constructorArguments: null); - var yetAnotherSubstitute = SubstitutionContext.Current.SubstituteFactory.CreatePartial(constructorArguments: null, typesToProxy: new[] {typeof(Foo)}); } } }"; - await VerifyFix(oldSource, newSource, diagnosticIndex: diagnosticIndex); + await VerifyFix(oldSource, newSource); } - public override async Task AppendsInternalsVisibleTo_WhenUsedWithInternalClass_AndArgumentListNotEmpty(int diagnosticIndex) + public override async Task AppendsInternalsVisibleTo_WhenUsedWithInternalClass_AndArgumentListNotEmpty() { var oldSource = @"using System.Reflection; using NSubstitute.Core; @@ -110,8 +102,6 @@ public class FooTests public void Test() { var substitute = SubstitutionContext.Current.SubstituteFactory.CreatePartial(new[] {typeof(Foo)}, null); - var otherSubstitute = SubstitutionContext.Current.SubstituteFactory.CreatePartial(typesToProxy: new[] {typeof(Foo)}, constructorArguments: null); - var yetAnotherSubstitute = SubstitutionContext.Current.SubstituteFactory.CreatePartial(constructorArguments: null, typesToProxy: new[] {typeof(Foo)}); } } }"; @@ -131,15 +121,13 @@ public class FooTests public void Test() { var substitute = SubstitutionContext.Current.SubstituteFactory.CreatePartial(new[] {typeof(Foo)}, null); - var otherSubstitute = SubstitutionContext.Current.SubstituteFactory.CreatePartial(typesToProxy: new[] {typeof(Foo)}, constructorArguments: null); - var yetAnotherSubstitute = SubstitutionContext.Current.SubstituteFactory.CreatePartial(constructorArguments: null, typesToProxy: new[] {typeof(Foo)}); } } }"; - await VerifyFix(oldSource, newSource, diagnosticIndex: diagnosticIndex); + await VerifyFix(oldSource, newSource); } - public override async Task AppendsInternalsVisibleTo_WhenUsedWithNestedInternalClass(int diagnosticIndex) + public override async Task AppendsInternalsVisibleTo_WhenUsedWithNestedInternalClass() { var oldSource = @"using NSubstitute.Core; namespace MyNamespace @@ -157,8 +145,6 @@ public class FooTests public void Test() { var substitute = SubstitutionContext.Current.SubstituteFactory.CreatePartial(new[] {typeof(Foo.Bar)}, null); - var otherSubstitute = SubstitutionContext.Current.SubstituteFactory.CreatePartial(typesToProxy: new[] {typeof(Foo.Bar)}, constructorArguments: null); - var yetAnotherSubstitute = SubstitutionContext.Current.SubstituteFactory.CreatePartial(constructorArguments: null, typesToProxy: new[] {typeof(Foo.Bar)}); } } }"; @@ -181,12 +167,10 @@ public class FooTests public void Test() { var substitute = SubstitutionContext.Current.SubstituteFactory.CreatePartial(new[] {typeof(Foo.Bar)}, null); - var otherSubstitute = SubstitutionContext.Current.SubstituteFactory.CreatePartial(typesToProxy: new[] {typeof(Foo.Bar)}, constructorArguments: null); - var yetAnotherSubstitute = SubstitutionContext.Current.SubstituteFactory.CreatePartial(constructorArguments: null, typesToProxy: new[] {typeof(Foo.Bar)}); } } }"; - await VerifyFix(oldSource, newSource, diagnosticIndex: diagnosticIndex); + await VerifyFix(oldSource, newSource); } public override async Task DoesNot_AppendsInternalsVisibleTo_WhenUsedWithPublicClass() diff --git a/tests/NSubstitute.Analyzers.Tests.CSharp/CodeFixProviderTests/SubstituteForInternalMemberCodeFixProviderTests/SubstituteForInternalMemberCodeFixVerifier.cs b/tests/NSubstitute.Analyzers.Tests.CSharp/CodeFixProviderTests/SubstituteForInternalMemberCodeFixProviderTests/SubstituteForInternalMemberCodeFixVerifier.cs index cfff275c..c0139c3c 100644 --- a/tests/NSubstitute.Analyzers.Tests.CSharp/CodeFixProviderTests/SubstituteForInternalMemberCodeFixProviderTests/SubstituteForInternalMemberCodeFixVerifier.cs +++ b/tests/NSubstitute.Analyzers.Tests.CSharp/CodeFixProviderTests/SubstituteForInternalMemberCodeFixProviderTests/SubstituteForInternalMemberCodeFixVerifier.cs @@ -1,5 +1,3 @@ -using System.Collections.Generic; -using System.Linq; using System.Threading.Tasks; using Microsoft.CodeAnalysis.CodeFixes; using Microsoft.CodeAnalysis.Diagnostics; @@ -12,28 +10,21 @@ namespace NSubstitute.Analyzers.Tests.CSharp.CodeFixProviderTests.SubstituteForI public abstract class SubstituteForInternalMemberCodeFixVerifier : CSharpCodeFixVerifier, ISubstituteForInternalMemberCodeFixVerifier { - public static IEnumerable DiagnosticIndicesTestCases => - Enumerable.Range(0, 3).Select(item => new object[] { item }); - protected override DiagnosticAnalyzer DiagnosticAnalyzer { get; } = new SubstituteAnalyzer(); protected override CodeFixProvider CodeFixProvider { get; } = new SubstituteForInternalMemberCodeFixProvider(); - [Theory] - [MemberData(nameof(DiagnosticIndicesTestCases))] - public abstract Task AppendsInternalsVisibleTo_ToTopLevelCompilationUnit_WhenUsedWithInternalClass(int diagnosticIndex); + [Fact] + public abstract Task AppendsInternalsVisibleTo_ToTopLevelCompilationUnit_WhenUsedWithInternalClass(); - [Theory] - [MemberData(nameof(DiagnosticIndicesTestCases))] - public abstract Task AppendsInternalsVisibleTo_WhenUsedWithInternalClass(int diagnosticIndex); + [Fact] + public abstract Task AppendsInternalsVisibleTo_WhenUsedWithInternalClass(); - [Theory] - [MemberData(nameof(DiagnosticIndicesTestCases))] - public abstract Task AppendsInternalsVisibleTo_WhenUsedWithInternalClass_AndArgumentListNotEmpty(int diagnosticIndex); + [Fact] + public abstract Task AppendsInternalsVisibleTo_WhenUsedWithInternalClass_AndArgumentListNotEmpty(); - [Theory] - [MemberData(nameof(DiagnosticIndicesTestCases))] - public abstract Task AppendsInternalsVisibleTo_WhenUsedWithNestedInternalClass(int diagnosticIndex); + [Fact] + public abstract Task AppendsInternalsVisibleTo_WhenUsedWithNestedInternalClass(); [Fact] public abstract Task DoesNot_AppendsInternalsVisibleTo_WhenUsedWithPublicClass(); diff --git a/tests/NSubstitute.Analyzers.Tests.CSharp/DiagnosticAnalyzerTests/ConflictingArgumentAssignmentsAnalyzerTests/ReturnsAsOrdinaryMethodTests.cs b/tests/NSubstitute.Analyzers.Tests.CSharp/DiagnosticAnalyzerTests/ConflictingArgumentAssignmentsAnalyzerTests/ReturnsAsOrdinaryMethodTests.cs index eb7f930a..5d6d4809 100644 --- a/tests/NSubstitute.Analyzers.Tests.CSharp/DiagnosticAnalyzerTests/ConflictingArgumentAssignmentsAnalyzerTests/ReturnsAsOrdinaryMethodTests.cs +++ b/tests/NSubstitute.Analyzers.Tests.CSharp/DiagnosticAnalyzerTests/ConflictingArgumentAssignmentsAnalyzerTests/ReturnsAsOrdinaryMethodTests.cs @@ -145,6 +145,22 @@ public void Test() {{ callInfo[0] = 1; }}, callInfo => {{}}); + {method}(value: substitute.Bar(Arg.Any()), returnThis: callInfo => + {{ + callInfo[0] = 1; + return 1; + }}).AndDoes(callInfo => + {{ + callInfo[0] = 1; + }}, callInfo => {{}}); + {method}(returnThis: callInfo => + {{ + callInfo[0] = 1; + return 1; + }}, value: substitute.Bar(Arg.Any())).AndDoes(callInfo => + {{ + callInfo[0] = 1; + }}, callInfo => {{}}); }} }} diff --git a/tests/NSubstitute.Analyzers.Tests.CSharp/DiagnosticAnalyzerTests/ConflictingArgumentAssignmentsAnalyzerTests/ThrowsAsOrdinaryMethodTests.cs b/tests/NSubstitute.Analyzers.Tests.CSharp/DiagnosticAnalyzerTests/ConflictingArgumentAssignmentsAnalyzerTests/ThrowsAsOrdinaryMethodTests.cs index feee7b67..23153db6 100644 --- a/tests/NSubstitute.Analyzers.Tests.CSharp/DiagnosticAnalyzerTests/ConflictingArgumentAssignmentsAnalyzerTests/ThrowsAsOrdinaryMethodTests.cs +++ b/tests/NSubstitute.Analyzers.Tests.CSharp/DiagnosticAnalyzerTests/ConflictingArgumentAssignmentsAnalyzerTests/ThrowsAsOrdinaryMethodTests.cs @@ -142,6 +142,22 @@ public void Test() {{ callInfo[0] = 1; }}, callInfo => {{}}); + {method}(value: substitute.Bar(Arg.Any()), createException: callInfo => + {{ + callInfo[0] = 1; + return new Exception(); + }}).AndDoes(callInfo => + {{ + callInfo[0] = 1; + }}, callInfo => {{}}); + {method}(createException: callInfo => + {{ + callInfo[0] = 1; + return new Exception(); + }}, value: substitute.Bar(Arg.Any())).AndDoes(callInfo => + {{ + callInfo[0] = 1; + }}, callInfo => {{}}); }} }} diff --git a/tests/NSubstitute.Analyzers.Tests.CSharp/DiagnosticAnalyzerTests/NonSubstitutableMemberReceivedAnalyzerTests/ReceivedAsOrdinaryMethodTests.cs b/tests/NSubstitute.Analyzers.Tests.CSharp/DiagnosticAnalyzerTests/NonSubstitutableMemberReceivedAnalyzerTests/ReceivedAsOrdinaryMethodTests.cs index 1b3e0b29..cc832228 100644 --- a/tests/NSubstitute.Analyzers.Tests.CSharp/DiagnosticAnalyzerTests/NonSubstitutableMemberReceivedAnalyzerTests/ReceivedAsOrdinaryMethodTests.cs +++ b/tests/NSubstitute.Analyzers.Tests.CSharp/DiagnosticAnalyzerTests/NonSubstitutableMemberReceivedAnalyzerTests/ReceivedAsOrdinaryMethodTests.cs @@ -480,17 +480,41 @@ public void Test() [CombinatoryData( "ReceivedExtensions.Received(substitute, Quantity.None())", + "ReceivedExtensions.Received(substitute: substitute, x: Quantity.None())", + "ReceivedExtensions.Received(x: Quantity.None(), substitute: substitute)", "ReceivedExtensions.Received(substitute, Quantity.None())", + "ReceivedExtensions.Received(substitute: substitute, x: Quantity.None())", + "ReceivedExtensions.Received(x: Quantity.None(), substitute: substitute)", "SubstituteExtensions.Received(substitute, 1, 1)", + "SubstituteExtensions.Received(substitute: substitute, x: 1, y: 1)", + "SubstituteExtensions.Received(x: 1, y: 1, substitute: substitute)", "SubstituteExtensions.Received(substitute, 1, 1)", + "SubstituteExtensions.Received(substitute: substitute, x: 1, y: 1)", + "SubstituteExtensions.Received(x: 1, y: 1, substitute: substitute)", "ReceivedExtensions.ReceivedWithAnyArgs(substitute, Quantity.None())", + "ReceivedExtensions.ReceivedWithAnyArgs(substitute: substitute, x: Quantity.None())", + "ReceivedExtensions.ReceivedWithAnyArgs(x: Quantity.None(), substitute: substitute)", "ReceivedExtensions.ReceivedWithAnyArgs(substitute, Quantity.None())", + "ReceivedExtensions.ReceivedWithAnyArgs(substitute: substitute, x: Quantity.None())", + "ReceivedExtensions.ReceivedWithAnyArgs(x: Quantity.None(), substitute: substitute)", "SubstituteExtensions.ReceivedWithAnyArgs(substitute, 1, 1)", + "SubstituteExtensions.ReceivedWithAnyArgs(substitute: substitute, x: 1, y: 1)", + "SubstituteExtensions.ReceivedWithAnyArgs(x: 1, y: 1, substitute: substitute)", "SubstituteExtensions.ReceivedWithAnyArgs(substitute, 1, 1)", + "SubstituteExtensions.ReceivedWithAnyArgs(substitute: substitute, x: 1, y: 1)", + "SubstituteExtensions.ReceivedWithAnyArgs(x: 1, y: 1, substitute: substitute)", "SubstituteExtensions.DidNotReceive(substitute, 1, 1)", + "SubstituteExtensions.DidNotReceive(substitute: substitute, x: 1, y: 1)", + "SubstituteExtensions.DidNotReceive(x: 1, y: 1, substitute: substitute)", "SubstituteExtensions.DidNotReceive(substitute, 1, 1)", + "SubstituteExtensions.DidNotReceive(substitute: substitute, x: 1, y: 1)", + "SubstituteExtensions.DidNotReceive(x: 1, y: 1, substitute: substitute)", "SubstituteExtensions.DidNotReceiveWithAnyArgs(substitute, 1, 1)", - "SubstituteExtensions.DidNotReceiveWithAnyArgs(substitute, 1, 1)")] + "SubstituteExtensions.DidNotReceiveWithAnyArgs(substitute: substitute, x: 1, y: 1)", + "SubstituteExtensions.DidNotReceiveWithAnyArgs(x: 1, y: 1, substitute: substitute)", + "SubstituteExtensions.DidNotReceiveWithAnyArgs(substitute, 1, 1)", + "SubstituteExtensions.DidNotReceiveWithAnyArgs(substitute: substitute, x: 1, y: 1)", + "SubstituteExtensions.DidNotReceiveWithAnyArgs(x: 1, y: 1, substitute: substitute)")] public override async Task ReportsNoDiagnostics_WhenUsingUnfortunatelyNamedMethod(string method) { var source = $@" diff --git a/tests/NSubstitute.Analyzers.Tests.CSharp/DiagnosticAnalyzerTests/ReceivedInReceivedInOrderAnalyzerTests/ReceivedAsOrdinaryMethodTests.cs b/tests/NSubstitute.Analyzers.Tests.CSharp/DiagnosticAnalyzerTests/ReceivedInReceivedInOrderAnalyzerTests/ReceivedAsOrdinaryMethodTests.cs index 702e7c19..457001c8 100644 --- a/tests/NSubstitute.Analyzers.Tests.CSharp/DiagnosticAnalyzerTests/ReceivedInReceivedInOrderAnalyzerTests/ReceivedAsOrdinaryMethodTests.cs +++ b/tests/NSubstitute.Analyzers.Tests.CSharp/DiagnosticAnalyzerTests/ReceivedInReceivedInOrderAnalyzerTests/ReceivedAsOrdinaryMethodTests.cs @@ -158,17 +158,41 @@ public void Test() [CombinatoryData( "ReceivedExtensions.Received(substitute, Quantity.None())", + "ReceivedExtensions.Received(substitute: substitute, x: Quantity.None())", + "ReceivedExtensions.Received(x: Quantity.None(), substitute: substitute)", "ReceivedExtensions.Received(substitute, Quantity.None())", + "ReceivedExtensions.Received(substitute: substitute, x: Quantity.None())", + "ReceivedExtensions.Received(x: Quantity.None(), substitute: substitute)", "SubstituteExtensions.Received(substitute, 1, 1)", + "SubstituteExtensions.Received(substitute: substitute, x: 1, y: 1)", + "SubstituteExtensions.Received(x: 1, y: 1, substitute: substitute)", "SubstituteExtensions.Received(substitute, 1, 1)", + "SubstituteExtensions.Received(substitute: substitute, x: 1, y: 1)", + "SubstituteExtensions.Received(x: 1, y: 1, substitute: substitute)", "ReceivedExtensions.ReceivedWithAnyArgs(substitute, Quantity.None())", + "ReceivedExtensions.ReceivedWithAnyArgs(substitute: substitute, x: Quantity.None())", + "ReceivedExtensions.ReceivedWithAnyArgs(x: Quantity.None(), substitute: substitute)", "ReceivedExtensions.ReceivedWithAnyArgs(substitute, Quantity.None())", + "ReceivedExtensions.ReceivedWithAnyArgs(substitute: substitute, x: Quantity.None())", + "ReceivedExtensions.ReceivedWithAnyArgs(x: Quantity.None(), substitute: substitute)", "SubstituteExtensions.ReceivedWithAnyArgs(substitute, 1, 1)", + "SubstituteExtensions.ReceivedWithAnyArgs(substitute: substitute, x: 1, y: 1)", + "SubstituteExtensions.ReceivedWithAnyArgs(x: 1, y: 1, substitute: substitute)", "SubstituteExtensions.ReceivedWithAnyArgs(substitute, 1, 1)", + "SubstituteExtensions.ReceivedWithAnyArgs(substitute: substitute, x: 1, y: 1)", + "SubstituteExtensions.ReceivedWithAnyArgs(x: 1, y: 1, substitute: substitute)", "SubstituteExtensions.DidNotReceive(substitute, 1, 1)", + "SubstituteExtensions.DidNotReceive(substitute: substitute, x: 1, y: 1)", + "SubstituteExtensions.DidNotReceive(x: 1, y: 1, substitute: substitute)", "SubstituteExtensions.DidNotReceive(substitute, 1, 1)", + "SubstituteExtensions.DidNotReceive(substitute: substitute, x: 1, y: 1)", + "SubstituteExtensions.DidNotReceive(x: 1, y: 1, substitute: substitute)", "SubstituteExtensions.DidNotReceiveWithAnyArgs(substitute, 1, 1)", - "SubstituteExtensions.DidNotReceiveWithAnyArgs(substitute, 1, 1)")] + "SubstituteExtensions.DidNotReceiveWithAnyArgs(substitute: substitute, x: 1, y: 1)", + "SubstituteExtensions.DidNotReceiveWithAnyArgs(x: 1, y: 1, substitute: substitute)", + "SubstituteExtensions.DidNotReceiveWithAnyArgs(substitute, 1, 1)", + "SubstituteExtensions.DidNotReceiveWithAnyArgs(substitute: substitute, x: 1, y: 1)", + "SubstituteExtensions.DidNotReceiveWithAnyArgs(x: 1, y: 1, substitute: substitute)")] public override async Task ReportsNoDiagnostics_WhenUsingUnfortunatelyNamedMethod(string method) { var source = $@" diff --git a/tests/NSubstitute.Analyzers.Tests.CSharp/DiagnosticAnalyzerTests/SubstituteAnalyzerTests/ForAsGenericMethodTests.cs b/tests/NSubstitute.Analyzers.Tests.CSharp/DiagnosticAnalyzerTests/SubstituteAnalyzerTests/ForAsGenericMethodTests.cs index 19bb6e70..6c93c706 100644 --- a/tests/NSubstitute.Analyzers.Tests.CSharp/DiagnosticAnalyzerTests/SubstituteAnalyzerTests/ForAsGenericMethodTests.cs +++ b/tests/NSubstitute.Analyzers.Tests.CSharp/DiagnosticAnalyzerTests/SubstituteAnalyzerTests/ForAsGenericMethodTests.cs @@ -637,6 +637,8 @@ public class FooTests public void Test() { var substitute = NSubstitute.Substitute.For(1, 2, 3); + var otherSubstitute = NSubstitute.Substitute.For(new object[] { 1, 2, 3 }); + var yetAnotherSubstitute = NSubstitute.Substitute.For(constructorArguments: new object[] { 1, 2, 3 }); } } }"; @@ -661,6 +663,8 @@ public class FooTests public void Test() { var substitute = [|NSubstitute.Substitute.For(1)|]; + var otherSubstitute = [|NSubstitute.Substitute.For(new [] { 1 })|]; + var yetAnotherSubstitute = [|NSubstitute.Substitute.For(constructorArguments: new [] { 1 })|]; } } }"; diff --git a/tests/NSubstitute.Analyzers.Tests.CSharp/DiagnosticAnalyzerTests/SubstituteAnalyzerTests/ForPartsOfMethodTests.cs b/tests/NSubstitute.Analyzers.Tests.CSharp/DiagnosticAnalyzerTests/SubstituteAnalyzerTests/ForPartsOfMethodTests.cs index f809311e..04448137 100644 --- a/tests/NSubstitute.Analyzers.Tests.CSharp/DiagnosticAnalyzerTests/SubstituteAnalyzerTests/ForPartsOfMethodTests.cs +++ b/tests/NSubstitute.Analyzers.Tests.CSharp/DiagnosticAnalyzerTests/SubstituteAnalyzerTests/ForPartsOfMethodTests.cs @@ -433,6 +433,7 @@ public class FooTests public void Test() { var substitute = NSubstitute.Substitute.ForPartsOf(1); + var otherSubstitute = NSubstitute.Substitute.ForPartsOf(constructorArguments: 1); } } }"; diff --git a/tests/NSubstitute.Analyzers.Tests.CSharp/DiagnosticAnalyzerTests/UnusedReceivedAnalyzerTests/ReceivedAsOrdinaryMethodTests.cs b/tests/NSubstitute.Analyzers.Tests.CSharp/DiagnosticAnalyzerTests/UnusedReceivedAnalyzerTests/ReceivedAsOrdinaryMethodTests.cs index fb4f1c44..3c13ac56 100644 --- a/tests/NSubstitute.Analyzers.Tests.CSharp/DiagnosticAnalyzerTests/UnusedReceivedAnalyzerTests/ReceivedAsOrdinaryMethodTests.cs +++ b/tests/NSubstitute.Analyzers.Tests.CSharp/DiagnosticAnalyzerTests/UnusedReceivedAnalyzerTests/ReceivedAsOrdinaryMethodTests.cs @@ -196,17 +196,41 @@ public void Test() [CombinatoryData( "ReceivedExtensions.Received(substitute, Quantity.None())", + "ReceivedExtensions.Received(substitute: substitute, x: Quantity.None())", + "ReceivedExtensions.Received(x: Quantity.None(), substitute: substitute)", "ReceivedExtensions.Received(substitute, Quantity.None())", + "ReceivedExtensions.Received(substitute: substitute, x: Quantity.None())", + "ReceivedExtensions.Received(x: Quantity.None(), substitute: substitute)", "SubstituteExtensions.Received(substitute, 1, 1)", + "SubstituteExtensions.Received(substitute: substitute, x: 1, y: 1)", + "SubstituteExtensions.Received(x: 1, y: 1, substitute: substitute)", "SubstituteExtensions.Received(substitute, 1, 1)", + "SubstituteExtensions.Received(substitute: substitute, x: 1, y: 1)", + "SubstituteExtensions.Received(x: 1, y: 1, substitute: substitute)", "ReceivedExtensions.ReceivedWithAnyArgs(substitute, Quantity.None())", + "ReceivedExtensions.ReceivedWithAnyArgs(substitute: substitute, x: Quantity.None())", + "ReceivedExtensions.ReceivedWithAnyArgs(x: Quantity.None(), substitute: substitute)", "ReceivedExtensions.ReceivedWithAnyArgs(substitute, Quantity.None())", + "ReceivedExtensions.ReceivedWithAnyArgs(substitute: substitute, x: Quantity.None())", + "ReceivedExtensions.ReceivedWithAnyArgs(x: Quantity.None(), substitute: substitute)", "SubstituteExtensions.ReceivedWithAnyArgs(substitute, 1, 1)", + "SubstituteExtensions.ReceivedWithAnyArgs(substitute: substitute, x: 1, y: 1)", + "SubstituteExtensions.ReceivedWithAnyArgs(x: 1, y: 1, substitute: substitute)", "SubstituteExtensions.ReceivedWithAnyArgs(substitute, 1, 1)", + "SubstituteExtensions.ReceivedWithAnyArgs(substitute: substitute, x: 1, y: 1)", + "SubstituteExtensions.ReceivedWithAnyArgs(x: 1, y: 1, substitute: substitute)", "SubstituteExtensions.DidNotReceive(substitute, 1, 1)", + "SubstituteExtensions.DidNotReceive(substitute: substitute, x: 1, y: 1)", + "SubstituteExtensions.DidNotReceive(x: 1, y: 1, substitute: substitute)", "SubstituteExtensions.DidNotReceive(substitute, 1, 1)", + "SubstituteExtensions.DidNotReceive(substitute: substitute, x: 1, y: 1)", + "SubstituteExtensions.DidNotReceive(x: 1, y: 1, substitute: substitute)", "SubstituteExtensions.DidNotReceiveWithAnyArgs(substitute, 1, 1)", - "SubstituteExtensions.DidNotReceiveWithAnyArgs(substitute, 1, 1)")] + "SubstituteExtensions.DidNotReceiveWithAnyArgs(substitute: substitute, x: 1, y: 1)", + "SubstituteExtensions.DidNotReceiveWithAnyArgs(x: 1, y: 1, substitute: substitute)", + "SubstituteExtensions.DidNotReceiveWithAnyArgs(substitute, 1, 1)", + "SubstituteExtensions.DidNotReceiveWithAnyArgs(substitute: substitute, x: 1, y: 1)", + "SubstituteExtensions.DidNotReceiveWithAnyArgs(x: 1, y: 1, substitute: substitute)")] public override async Task ReportsNoDiagnostics_WhenUsedWithUnfortunatelyNamedMethod(string method) { var source = $@"using System; diff --git a/tests/NSubstitute.Analyzers.Tests.Shared/CodeFixProviders/CodeFixVerifier.cs b/tests/NSubstitute.Analyzers.Tests.Shared/CodeFixProviders/CodeFixVerifier.cs index 51384e6e..c87ba991 100644 --- a/tests/NSubstitute.Analyzers.Tests.Shared/CodeFixProviders/CodeFixVerifier.cs +++ b/tests/NSubstitute.Analyzers.Tests.Shared/CodeFixProviders/CodeFixVerifier.cs @@ -25,34 +25,9 @@ protected CodeFixVerifier(WorkspaceFactory workspaceFactory) protected abstract DiagnosticAnalyzer DiagnosticAnalyzer { get; } - protected Task VerifyFix( - string oldSource, - string newSource) => - VerifyFix(oldSource, newSource, null, NSubstituteVersion.Latest); - - protected Task VerifyFix( - string oldSource, - string newSource, - int codeFixIndex) => - VerifyFix(oldSource, newSource, codeFixIndex, NSubstituteVersion.Latest); - - protected Task VerifyFix( - string oldSource, - string newSource, - NSubstituteVersion version) => - VerifyFix(oldSource, newSource, diagnosticIndex: null, codeFixIndex: null, version); - - protected Task VerifyFix( - string oldSource, - string newSource, - int? codeFixIndex = null, - NSubstituteVersion version = NSubstituteVersion.Latest) => - VerifyFix(oldSource, newSource, null, codeFixIndex, version); - protected async Task VerifyFix( string oldSource, string newSource, - int? diagnosticIndex = null, int? codeFixIndex = null, NSubstituteVersion version = NSubstituteVersion.Latest) { @@ -74,12 +49,12 @@ protected async Task VerifyFix( project.AnalyzerOptions); var previousAnalyzerDiagnostics = analyzerDiagnostics; - var attempts = !diagnosticIndex.HasValue ? analyzerDiagnostics.Length : 1; + var attempts = analyzerDiagnostics.Length; for (var i = 0; i < attempts; ++i) { var actions = new List(); - var context = new CodeFixContext(document, analyzerDiagnostics[diagnosticIndex ?? 0], (a, _) => actions.Add(a), CancellationToken.None); + var context = new CodeFixContext(document, analyzerDiagnostics[0], (a, _) => actions.Add(a), CancellationToken.None); await CodeFixProvider.RegisterCodeFixesAsync(context); if (!actions.Any()) diff --git a/tests/NSubstitute.Analyzers.Tests.Shared/CodeFixProviders/ISubstituteForInternalMemberCodeFixVerifier.cs b/tests/NSubstitute.Analyzers.Tests.Shared/CodeFixProviders/ISubstituteForInternalMemberCodeFixVerifier.cs index 00e76875..f349df15 100644 --- a/tests/NSubstitute.Analyzers.Tests.Shared/CodeFixProviders/ISubstituteForInternalMemberCodeFixVerifier.cs +++ b/tests/NSubstitute.Analyzers.Tests.Shared/CodeFixProviders/ISubstituteForInternalMemberCodeFixVerifier.cs @@ -4,13 +4,13 @@ namespace NSubstitute.Analyzers.Tests.Shared.CodeFixProviders; public interface ISubstituteForInternalMemberCodeFixVerifier { - Task AppendsInternalsVisibleTo_ToTopLevelCompilationUnit_WhenUsedWithInternalClass(int diagnosticIndex); + Task AppendsInternalsVisibleTo_ToTopLevelCompilationUnit_WhenUsedWithInternalClass(); - Task AppendsInternalsVisibleTo_WhenUsedWithInternalClass(int diagnosticIndex); + Task AppendsInternalsVisibleTo_WhenUsedWithInternalClass(); - Task AppendsInternalsVisibleTo_WhenUsedWithInternalClass_AndArgumentListNotEmpty(int diagnosticIndex); + Task AppendsInternalsVisibleTo_WhenUsedWithInternalClass_AndArgumentListNotEmpty(); - Task AppendsInternalsVisibleTo_WhenUsedWithNestedInternalClass(int diagnosticIndex); + Task AppendsInternalsVisibleTo_WhenUsedWithNestedInternalClass(); Task DoesNot_AppendsInternalsVisibleTo_WhenUsedWithPublicClass(); diff --git a/tests/NSubstitute.Analyzers.Tests.VisualBasic/CodeFixProvidersTests/SubstituteForInternalMemberCodeFixProviderTests/ForAsGenericMethodTests.cs b/tests/NSubstitute.Analyzers.Tests.VisualBasic/CodeFixProvidersTests/SubstituteForInternalMemberCodeFixProviderTests/ForAsGenericMethodTests.cs index bfee457b..bbb2cba1 100644 --- a/tests/NSubstitute.Analyzers.Tests.VisualBasic/CodeFixProvidersTests/SubstituteForInternalMemberCodeFixProviderTests/ForAsGenericMethodTests.cs +++ b/tests/NSubstitute.Analyzers.Tests.VisualBasic/CodeFixProvidersTests/SubstituteForInternalMemberCodeFixProviderTests/ForAsGenericMethodTests.cs @@ -4,7 +4,7 @@ namespace NSubstitute.Analyzers.Tests.VisualBasic.CodeFixProvidersTests.Substitu public class ForAsGenericMethodTests : SubstituteForInternalMemberCodeFixVerifier { - public override async Task AppendsInternalsVisibleTo_ToTopLevelCompilationUnit_WhenUsedWithInternalClass(int diagnosticIndex) + public override async Task AppendsInternalsVisibleTo_ToTopLevelCompilationUnit_WhenUsedWithInternalClass() { var oldSource = @"Imports NSubstitute @@ -40,7 +40,7 @@ End Namespace await VerifyFix(oldSource, newSource); } - public override async Task AppendsInternalsVisibleTo_WhenUsedWithInternalClass(int diagnosticIndex) + public override async Task AppendsInternalsVisibleTo_WhenUsedWithInternalClass() { var oldSource = @"Imports NSubstitute.Core @@ -72,8 +72,7 @@ End Namespace await VerifyFix(oldSource, newSource); } - public override async Task AppendsInternalsVisibleTo_WhenUsedWithInternalClass_AndArgumentListNotEmpty( - int diagnosticIndex) + public override async Task AppendsInternalsVisibleTo_WhenUsedWithInternalClass_AndArgumentListNotEmpty() { var oldSource = @"Imports System.Reflection Imports NSubstitute.Core @@ -107,7 +106,7 @@ End Namespace await VerifyFix(oldSource, newSource); } - public override async Task AppendsInternalsVisibleTo_WhenUsedWithNestedInternalClass(int diagnosticIndex) + public override async Task AppendsInternalsVisibleTo_WhenUsedWithNestedInternalClass() { var oldSource = @"Imports NSubstitute.Core diff --git a/tests/NSubstitute.Analyzers.Tests.VisualBasic/CodeFixProvidersTests/SubstituteForInternalMemberCodeFixProviderTests/ForAsNonGenericMethodTests.cs b/tests/NSubstitute.Analyzers.Tests.VisualBasic/CodeFixProvidersTests/SubstituteForInternalMemberCodeFixProviderTests/ForAsNonGenericMethodTests.cs index 598ca5b8..1fab19f5 100644 --- a/tests/NSubstitute.Analyzers.Tests.VisualBasic/CodeFixProvidersTests/SubstituteForInternalMemberCodeFixProviderTests/ForAsNonGenericMethodTests.cs +++ b/tests/NSubstitute.Analyzers.Tests.VisualBasic/CodeFixProvidersTests/SubstituteForInternalMemberCodeFixProviderTests/ForAsNonGenericMethodTests.cs @@ -4,7 +4,7 @@ namespace NSubstitute.Analyzers.Tests.VisualBasic.CodeFixProvidersTests.Substitu public class ForAsNonGenericMethodTests : SubstituteForInternalMemberCodeFixVerifier { - public override async Task AppendsInternalsVisibleTo_ToTopLevelCompilationUnit_WhenUsedWithInternalClass(int diagnosticIndex) + public override async Task AppendsInternalsVisibleTo_ToTopLevelCompilationUnit_WhenUsedWithInternalClass() { var oldSource = @"Imports NSubstitute.Core @@ -16,8 +16,6 @@ End Class Public Class FooTests Public Sub Test() Dim substitute = NSubstitute.Substitute.[For]({GetType(Foo)}, Nothing) - Dim otherSubstitute = NSubstitute.Substitute.[For](typesToProxy:= {GetType(Foo)}, constructorArguments:= Nothing) - Dim yetAnotherSubstitute = NSubstitute.Substitute.[For](constructorArguments:= Nothing, typesToProxy:= {GetType(Foo)}) End Sub End Class End Namespace @@ -34,17 +32,15 @@ End Class Public Class FooTests Public Sub Test() Dim substitute = NSubstitute.Substitute.[For]({GetType(Foo)}, Nothing) - Dim otherSubstitute = NSubstitute.Substitute.[For](typesToProxy:= {GetType(Foo)}, constructorArguments:= Nothing) - Dim yetAnotherSubstitute = NSubstitute.Substitute.[For](constructorArguments:= Nothing, typesToProxy:= {GetType(Foo)}) End Sub End Class End Namespace End Namespace "; - await VerifyFix(oldSource, newSource, diagnosticIndex: diagnosticIndex); + await VerifyFix(oldSource, newSource); } - public override async Task AppendsInternalsVisibleTo_WhenUsedWithInternalClass(int diagnosticIndex) + public override async Task AppendsInternalsVisibleTo_WhenUsedWithInternalClass() { var oldSource = @"Imports NSubstitute.Core @@ -55,8 +51,6 @@ End Class Public Class FooTests Public Sub Test() Dim substitute = NSubstitute.Substitute.[For]({GetType(Foo)}, Nothing) - Dim otherSubstitute = NSubstitute.Substitute.[For](typesToProxy:= {GetType(Foo)}, constructorArguments:= Nothing) - Dim yetAnotherSubstitute = NSubstitute.Substitute.[For](constructorArguments:= Nothing, typesToProxy:= {GetType(Foo)}) End Sub End Class End Namespace @@ -71,16 +65,14 @@ End Class Public Class FooTests Public Sub Test() Dim substitute = NSubstitute.Substitute.[For]({GetType(Foo)}, Nothing) - Dim otherSubstitute = NSubstitute.Substitute.[For](typesToProxy:= {GetType(Foo)}, constructorArguments:= Nothing) - Dim yetAnotherSubstitute = NSubstitute.Substitute.[For](constructorArguments:= Nothing, typesToProxy:= {GetType(Foo)}) End Sub End Class End Namespace "; - await VerifyFix(oldSource, newSource, diagnosticIndex: diagnosticIndex); + await VerifyFix(oldSource, newSource); } - public override async Task AppendsInternalsVisibleTo_WhenUsedWithInternalClass_AndArgumentListNotEmpty(int diagnosticIndex) + public override async Task AppendsInternalsVisibleTo_WhenUsedWithInternalClass_AndArgumentListNotEmpty() { var oldSource = @"Imports System.Reflection Imports NSubstitute.Core @@ -92,8 +84,6 @@ End Class Public Class FooTests Public Sub Test() Dim substitute = NSubstitute.Substitute.[For]({GetType(Foo)}, Nothing) - Dim otherSubstitute = NSubstitute.Substitute.[For](typesToProxy:= {GetType(Foo)}, constructorArguments:= Nothing) - Dim yetAnotherSubstitute = NSubstitute.Substitute.[For](constructorArguments:= Nothing, typesToProxy:= {GetType(Foo)}) End Sub End Class End Namespace @@ -109,16 +99,14 @@ End Class Public Class FooTests Public Sub Test() Dim substitute = NSubstitute.Substitute.[For]({GetType(Foo)}, Nothing) - Dim otherSubstitute = NSubstitute.Substitute.[For](typesToProxy:= {GetType(Foo)}, constructorArguments:= Nothing) - Dim yetAnotherSubstitute = NSubstitute.Substitute.[For](constructorArguments:= Nothing, typesToProxy:= {GetType(Foo)}) End Sub End Class End Namespace "; - await VerifyFix(oldSource, newSource, diagnosticIndex: diagnosticIndex); + await VerifyFix(oldSource, newSource); } - public override async Task AppendsInternalsVisibleTo_WhenUsedWithNestedInternalClass(int diagnosticIndex) + public override async Task AppendsInternalsVisibleTo_WhenUsedWithNestedInternalClass() { var oldSource = @"Imports NSubstitute.Core @@ -131,8 +119,6 @@ End Class Public Class FooTests Public Sub Test() Dim substitute = NSubstitute.Substitute.[For]({GetType(Foo.Bar)}, Nothing) - Dim otherSubstitute = NSubstitute.Substitute.[For](typesToProxy:= {GetType(Foo.Bar)}, constructorArguments:= Nothing) - Dim yetAnotherSubstitute = NSubstitute.Substitute.[For](constructorArguments:= Nothing, typesToProxy:= {GetType(Foo.Bar)}) End Sub End Class End Namespace @@ -149,13 +135,11 @@ End Class Public Class FooTests Public Sub Test() Dim substitute = NSubstitute.Substitute.[For]({GetType(Foo.Bar)}, Nothing) - Dim otherSubstitute = NSubstitute.Substitute.[For](typesToProxy:= {GetType(Foo.Bar)}, constructorArguments:= Nothing) - Dim yetAnotherSubstitute = NSubstitute.Substitute.[For](constructorArguments:= Nothing, typesToProxy:= {GetType(Foo.Bar)}) End Sub End Class End Namespace "; - await VerifyFix(oldSource, newSource, diagnosticIndex: diagnosticIndex); + await VerifyFix(oldSource, newSource); } public override async Task DoesNot_AppendsInternalsVisibleTo_WhenUsedWithPublicClass() diff --git a/tests/NSubstitute.Analyzers.Tests.VisualBasic/CodeFixProvidersTests/SubstituteForInternalMemberCodeFixProviderTests/ForPartsOfMethodTests.cs b/tests/NSubstitute.Analyzers.Tests.VisualBasic/CodeFixProvidersTests/SubstituteForInternalMemberCodeFixProviderTests/ForPartsOfMethodTests.cs index a7de9762..a80fb9a4 100644 --- a/tests/NSubstitute.Analyzers.Tests.VisualBasic/CodeFixProvidersTests/SubstituteForInternalMemberCodeFixProviderTests/ForPartsOfMethodTests.cs +++ b/tests/NSubstitute.Analyzers.Tests.VisualBasic/CodeFixProvidersTests/SubstituteForInternalMemberCodeFixProviderTests/ForPartsOfMethodTests.cs @@ -4,7 +4,7 @@ namespace NSubstitute.Analyzers.Tests.VisualBasic.CodeFixProvidersTests.Substitu public class ForPartsOfMethodTests : SubstituteForInternalMemberCodeFixVerifier { - public override async Task AppendsInternalsVisibleTo_ToTopLevelCompilationUnit_WhenUsedWithInternalClass(int diagnosticIndex) + public override async Task AppendsInternalsVisibleTo_ToTopLevelCompilationUnit_WhenUsedWithInternalClass() { var oldSource = @"Imports NSubstitute @@ -40,7 +40,7 @@ End Namespace await VerifyFix(oldSource, newSource); } - public override async Task AppendsInternalsVisibleTo_WhenUsedWithInternalClass(int diagnosticIndex) + public override async Task AppendsInternalsVisibleTo_WhenUsedWithInternalClass() { var oldSource = @"Imports NSubstitute.Core @@ -72,8 +72,7 @@ End Namespace await VerifyFix(oldSource, newSource); } - public override async Task AppendsInternalsVisibleTo_WhenUsedWithInternalClass_AndArgumentListNotEmpty( - int diagnosticIndex) + public override async Task AppendsInternalsVisibleTo_WhenUsedWithInternalClass_AndArgumentListNotEmpty() { var oldSource = @"Imports System.Reflection Imports NSubstitute.Core @@ -107,7 +106,7 @@ End Namespace await VerifyFix(oldSource, newSource); } - public override async Task AppendsInternalsVisibleTo_WhenUsedWithNestedInternalClass(int diagnosticIndex) + public override async Task AppendsInternalsVisibleTo_WhenUsedWithNestedInternalClass() { var oldSource = @"Imports NSubstitute.Core diff --git a/tests/NSubstitute.Analyzers.Tests.VisualBasic/CodeFixProvidersTests/SubstituteForInternalMemberCodeFixProviderTests/SubstituteFactoryCreateMethodTests.cs b/tests/NSubstitute.Analyzers.Tests.VisualBasic/CodeFixProvidersTests/SubstituteForInternalMemberCodeFixProviderTests/SubstituteFactoryCreateMethodTests.cs index 143fda60..6e463f04 100644 --- a/tests/NSubstitute.Analyzers.Tests.VisualBasic/CodeFixProvidersTests/SubstituteForInternalMemberCodeFixProviderTests/SubstituteFactoryCreateMethodTests.cs +++ b/tests/NSubstitute.Analyzers.Tests.VisualBasic/CodeFixProvidersTests/SubstituteForInternalMemberCodeFixProviderTests/SubstituteFactoryCreateMethodTests.cs @@ -4,7 +4,7 @@ namespace NSubstitute.Analyzers.Tests.VisualBasic.CodeFixProvidersTests.Substitu public class SubstituteFactoryCreateMethodTests : SubstituteForInternalMemberCodeFixVerifier { - public override async Task AppendsInternalsVisibleTo_ToTopLevelCompilationUnit_WhenUsedWithInternalClass(int diagnosticIndex) + public override async Task AppendsInternalsVisibleTo_ToTopLevelCompilationUnit_WhenUsedWithInternalClass() { var oldSource = @"Imports NSubstitute.Core @@ -16,8 +16,6 @@ End Class Public Class FooTests Public Sub Test() Dim substitute = SubstitutionContext.Current.SubstituteFactory.Create({GetType(Foo)}, Nothing) - Dim otherSubstitute = SubstitutionContext.Current.SubstituteFactory.Create(typesToProxy:= {GetType(Foo)}, constructorArguments:= Nothing) - Dim yetAnotherSubstitute = SubstitutionContext.Current.SubstituteFactory.Create(constructorArguments:= Nothing, typesToProxy:= {GetType(Foo)}) End Sub End Class End Namespace @@ -34,17 +32,15 @@ End Class Public Class FooTests Public Sub Test() Dim substitute = SubstitutionContext.Current.SubstituteFactory.Create({GetType(Foo)}, Nothing) - Dim otherSubstitute = SubstitutionContext.Current.SubstituteFactory.Create(typesToProxy:= {GetType(Foo)}, constructorArguments:= Nothing) - Dim yetAnotherSubstitute = SubstitutionContext.Current.SubstituteFactory.Create(constructorArguments:= Nothing, typesToProxy:= {GetType(Foo)}) End Sub End Class End Namespace End Namespace "; - await VerifyFix(oldSource, newSource, diagnosticIndex: diagnosticIndex); + await VerifyFix(oldSource, newSource); } - public override async Task AppendsInternalsVisibleTo_WhenUsedWithInternalClass(int diagnosticIndex) + public override async Task AppendsInternalsVisibleTo_WhenUsedWithInternalClass() { var oldSource = @"Imports NSubstitute.Core @@ -55,8 +51,6 @@ End Class Public Class FooTests Public Sub Test() Dim substitute = SubstitutionContext.Current.SubstituteFactory.Create({GetType(Foo)}, Nothing) - Dim otherSubstitute = SubstitutionContext.Current.SubstituteFactory.Create(typesToProxy:= {GetType(Foo)}, constructorArguments:= Nothing) - Dim yetAnotherSubstitute = SubstitutionContext.Current.SubstituteFactory.Create(constructorArguments:= Nothing, typesToProxy:= {GetType(Foo)}) End Sub End Class End Namespace @@ -71,16 +65,14 @@ End Class Public Class FooTests Public Sub Test() Dim substitute = SubstitutionContext.Current.SubstituteFactory.Create({GetType(Foo)}, Nothing) - Dim otherSubstitute = SubstitutionContext.Current.SubstituteFactory.Create(typesToProxy:= {GetType(Foo)}, constructorArguments:= Nothing) - Dim yetAnotherSubstitute = SubstitutionContext.Current.SubstituteFactory.Create(constructorArguments:= Nothing, typesToProxy:= {GetType(Foo)}) End Sub End Class End Namespace "; - await VerifyFix(oldSource, newSource, diagnosticIndex: diagnosticIndex); + await VerifyFix(oldSource, newSource); } - public override async Task AppendsInternalsVisibleTo_WhenUsedWithInternalClass_AndArgumentListNotEmpty(int diagnosticIndex) + public override async Task AppendsInternalsVisibleTo_WhenUsedWithInternalClass_AndArgumentListNotEmpty() { var oldSource = @"Imports System.Reflection Imports NSubstitute.Core @@ -92,8 +84,6 @@ End Class Public Class FooTests Public Sub Test() Dim substitute = SubstitutionContext.Current.SubstituteFactory.Create({GetType(Foo)}, Nothing) - Dim otherSubstitute = SubstitutionContext.Current.SubstituteFactory.Create(typesToProxy:= {GetType(Foo)}, constructorArguments:= Nothing) - Dim yetAnotherSubstitute = SubstitutionContext.Current.SubstituteFactory.Create(constructorArguments:= Nothing, typesToProxy:= {GetType(Foo)}) End Sub End Class End Namespace @@ -109,16 +99,14 @@ End Class Public Class FooTests Public Sub Test() Dim substitute = SubstitutionContext.Current.SubstituteFactory.Create({GetType(Foo)}, Nothing) - Dim otherSubstitute = SubstitutionContext.Current.SubstituteFactory.Create(typesToProxy:= {GetType(Foo)}, constructorArguments:= Nothing) - Dim yetAnotherSubstitute = SubstitutionContext.Current.SubstituteFactory.Create(constructorArguments:= Nothing, typesToProxy:= {GetType(Foo)}) End Sub End Class End Namespace "; - await VerifyFix(oldSource, newSource, diagnosticIndex: diagnosticIndex); + await VerifyFix(oldSource, newSource); } - public override async Task AppendsInternalsVisibleTo_WhenUsedWithNestedInternalClass(int diagnosticIndex) + public override async Task AppendsInternalsVisibleTo_WhenUsedWithNestedInternalClass() { var oldSource = @"Imports NSubstitute.Core @@ -131,8 +119,6 @@ End Class Public Class FooTests Public Sub Test() Dim substitute = SubstitutionContext.Current.SubstituteFactory.Create({GetType(Foo.Bar)}, Nothing) - Dim otherSubstitute = SubstitutionContext.Current.SubstituteFactory.Create(typesToProxy:= {GetType(Foo.Bar)}, constructorArguments:= Nothing) - Dim yetAnotherSubstitute = SubstitutionContext.Current.SubstituteFactory.Create(constructorArguments:= Nothing, typesToProxy:= {GetType(Foo.Bar)}) End Sub End Class End Namespace @@ -149,13 +135,11 @@ End Class Public Class FooTests Public Sub Test() Dim substitute = SubstitutionContext.Current.SubstituteFactory.Create({GetType(Foo.Bar)}, Nothing) - Dim otherSubstitute = SubstitutionContext.Current.SubstituteFactory.Create(typesToProxy:= {GetType(Foo.Bar)}, constructorArguments:= Nothing) - Dim yetAnotherSubstitute = SubstitutionContext.Current.SubstituteFactory.Create(constructorArguments:= Nothing, typesToProxy:= {GetType(Foo.Bar)}) End Sub End Class End Namespace "; - await VerifyFix(oldSource, newSource, diagnosticIndex: diagnosticIndex); + await VerifyFix(oldSource, newSource); } public override async Task DoesNot_AppendsInternalsVisibleTo_WhenUsedWithPublicClass() diff --git a/tests/NSubstitute.Analyzers.Tests.VisualBasic/CodeFixProvidersTests/SubstituteForInternalMemberCodeFixProviderTests/SubstituteFactoryCreatePartialMethodTests.cs b/tests/NSubstitute.Analyzers.Tests.VisualBasic/CodeFixProvidersTests/SubstituteForInternalMemberCodeFixProviderTests/SubstituteFactoryCreatePartialMethodTests.cs index 59632db5..141e8da7 100644 --- a/tests/NSubstitute.Analyzers.Tests.VisualBasic/CodeFixProvidersTests/SubstituteForInternalMemberCodeFixProviderTests/SubstituteFactoryCreatePartialMethodTests.cs +++ b/tests/NSubstitute.Analyzers.Tests.VisualBasic/CodeFixProvidersTests/SubstituteForInternalMemberCodeFixProviderTests/SubstituteFactoryCreatePartialMethodTests.cs @@ -4,7 +4,7 @@ namespace NSubstitute.Analyzers.Tests.VisualBasic.CodeFixProvidersTests.Substitu public class SubstituteFactoryCreatePartialMethodTests : SubstituteForInternalMemberCodeFixVerifier { - public override async Task AppendsInternalsVisibleTo_ToTopLevelCompilationUnit_WhenUsedWithInternalClass(int diagnosticIndex) + public override async Task AppendsInternalsVisibleTo_ToTopLevelCompilationUnit_WhenUsedWithInternalClass() { var oldSource = @"Imports NSubstitute.Core @@ -16,8 +16,6 @@ End Class Public Class FooTests Public Sub Test() Dim substitute = SubstitutionContext.Current.SubstituteFactory.CreatePartial({GetType(Foo)}, Nothing) - Dim otherSubstitute = SubstitutionContext.Current.SubstituteFactory.CreatePartial(typesToProxy:= {GetType(Foo)}, constructorArguments:= Nothing) - Dim yetAnotherSubstitute = SubstitutionContext.Current.SubstituteFactory.CreatePartial(constructorArguments:= Nothing, typesToProxy:= {GetType(Foo)}) End Sub End Class End Namespace @@ -34,17 +32,15 @@ End Class Public Class FooTests Public Sub Test() Dim substitute = SubstitutionContext.Current.SubstituteFactory.CreatePartial({GetType(Foo)}, Nothing) - Dim otherSubstitute = SubstitutionContext.Current.SubstituteFactory.CreatePartial(typesToProxy:= {GetType(Foo)}, constructorArguments:= Nothing) - Dim yetAnotherSubstitute = SubstitutionContext.Current.SubstituteFactory.CreatePartial(constructorArguments:= Nothing, typesToProxy:= {GetType(Foo)}) End Sub End Class End Namespace End Namespace "; - await VerifyFix(oldSource, newSource, diagnosticIndex: diagnosticIndex); + await VerifyFix(oldSource, newSource); } - public override async Task AppendsInternalsVisibleTo_WhenUsedWithInternalClass(int diagnosticIndex) + public override async Task AppendsInternalsVisibleTo_WhenUsedWithInternalClass() { var oldSource = @"Imports NSubstitute.Core @@ -55,8 +51,6 @@ End Class Public Class FooTests Public Sub Test() Dim substitute = SubstitutionContext.Current.SubstituteFactory.CreatePartial({GetType(Foo)}, Nothing) - Dim otherSubstitute = SubstitutionContext.Current.SubstituteFactory.CreatePartial(typesToProxy:= {GetType(Foo)}, constructorArguments:= Nothing) - Dim yetAnotherSubstitute = SubstitutionContext.Current.SubstituteFactory.CreatePartial(constructorArguments:= Nothing, typesToProxy:= {GetType(Foo)}) End Sub End Class End Namespace @@ -71,16 +65,14 @@ End Class Public Class FooTests Public Sub Test() Dim substitute = SubstitutionContext.Current.SubstituteFactory.CreatePartial({GetType(Foo)}, Nothing) - Dim otherSubstitute = SubstitutionContext.Current.SubstituteFactory.CreatePartial(typesToProxy:= {GetType(Foo)}, constructorArguments:= Nothing) - Dim yetAnotherSubstitute = SubstitutionContext.Current.SubstituteFactory.CreatePartial(constructorArguments:= Nothing, typesToProxy:= {GetType(Foo)}) End Sub End Class End Namespace "; - await VerifyFix(oldSource, newSource, diagnosticIndex: diagnosticIndex); + await VerifyFix(oldSource, newSource); } - public override async Task AppendsInternalsVisibleTo_WhenUsedWithInternalClass_AndArgumentListNotEmpty(int diagnosticIndex) + public override async Task AppendsInternalsVisibleTo_WhenUsedWithInternalClass_AndArgumentListNotEmpty() { var oldSource = @"Imports System.Reflection Imports NSubstitute.Core @@ -92,8 +84,6 @@ End Class Public Class FooTests Public Sub Test() Dim substitute = SubstitutionContext.Current.SubstituteFactory.CreatePartial({GetType(Foo)}, Nothing) - Dim otherSubstitute = SubstitutionContext.Current.SubstituteFactory.CreatePartial(typesToProxy:= {GetType(Foo)}, constructorArguments:= Nothing) - Dim yetAnotherSubstitute = SubstitutionContext.Current.SubstituteFactory.CreatePartial(constructorArguments:= Nothing, typesToProxy:= {GetType(Foo)}) End Sub End Class End Namespace @@ -109,16 +99,14 @@ End Class Public Class FooTests Public Sub Test() Dim substitute = SubstitutionContext.Current.SubstituteFactory.CreatePartial({GetType(Foo)}, Nothing) - Dim otherSubstitute = SubstitutionContext.Current.SubstituteFactory.CreatePartial(typesToProxy:= {GetType(Foo)}, constructorArguments:= Nothing) - Dim yetAnotherSubstitute = SubstitutionContext.Current.SubstituteFactory.CreatePartial(constructorArguments:= Nothing, typesToProxy:= {GetType(Foo)}) End Sub End Class End Namespace "; - await VerifyFix(oldSource, newSource, diagnosticIndex: diagnosticIndex); + await VerifyFix(oldSource, newSource); } - public override async Task AppendsInternalsVisibleTo_WhenUsedWithNestedInternalClass(int diagnosticIndex) + public override async Task AppendsInternalsVisibleTo_WhenUsedWithNestedInternalClass() { var oldSource = @"Imports NSubstitute.Core @@ -131,8 +119,6 @@ End Class Public Class FooTests Public Sub Test() Dim substitute = SubstitutionContext.Current.SubstituteFactory.CreatePartial({GetType(Foo.Bar)}, Nothing) - Dim otherSubstitute = SubstitutionContext.Current.SubstituteFactory.CreatePartial(typesToProxy:= {GetType(Foo.Bar)}, constructorArguments:= Nothing) - Dim yetAnotherSubstitute = SubstitutionContext.Current.SubstituteFactory.CreatePartial(constructorArguments:= Nothing, typesToProxy:= {GetType(Foo.Bar)}) End Sub End Class End Namespace @@ -149,13 +135,11 @@ End Class Public Class FooTests Public Sub Test() Dim substitute = SubstitutionContext.Current.SubstituteFactory.CreatePartial({GetType(Foo.Bar)}, Nothing) - Dim otherSubstitute = SubstitutionContext.Current.SubstituteFactory.CreatePartial(typesToProxy:= {GetType(Foo.Bar)}, constructorArguments:= Nothing) - Dim yetAnotherSubstitute = SubstitutionContext.Current.SubstituteFactory.CreatePartial(constructorArguments:= Nothing, typesToProxy:= {GetType(Foo.Bar)}) End Sub End Class End Namespace "; - await VerifyFix(oldSource, newSource, diagnosticIndex: diagnosticIndex); + await VerifyFix(oldSource, newSource); } public override async Task DoesNot_AppendsInternalsVisibleTo_WhenUsedWithPublicClass() diff --git a/tests/NSubstitute.Analyzers.Tests.VisualBasic/CodeFixProvidersTests/SubstituteForInternalMemberCodeFixProviderTests/SubstituteForInternalMemberCodeFixVerifier.cs b/tests/NSubstitute.Analyzers.Tests.VisualBasic/CodeFixProvidersTests/SubstituteForInternalMemberCodeFixProviderTests/SubstituteForInternalMemberCodeFixVerifier.cs index 105fcda2..50cf1d3d 100644 --- a/tests/NSubstitute.Analyzers.Tests.VisualBasic/CodeFixProvidersTests/SubstituteForInternalMemberCodeFixProviderTests/SubstituteForInternalMemberCodeFixVerifier.cs +++ b/tests/NSubstitute.Analyzers.Tests.VisualBasic/CodeFixProvidersTests/SubstituteForInternalMemberCodeFixProviderTests/SubstituteForInternalMemberCodeFixVerifier.cs @@ -1,5 +1,3 @@ -using System.Collections.Generic; -using System.Linq; using System.Threading.Tasks; using Microsoft.CodeAnalysis.CodeFixes; using Microsoft.CodeAnalysis.Diagnostics; @@ -12,28 +10,21 @@ namespace NSubstitute.Analyzers.Tests.VisualBasic.CodeFixProvidersTests.Substitu public abstract class SubstituteForInternalMemberCodeFixVerifier : VisualBasicCodeFixVerifier, ISubstituteForInternalMemberCodeFixVerifier { - public static IEnumerable DiagnosticIndicesTestCases => - Enumerable.Range(0, 3).Select(item => new object[] { item }); - protected override DiagnosticAnalyzer DiagnosticAnalyzer { get; } = new SubstituteAnalyzer(); protected override CodeFixProvider CodeFixProvider { get; } = new SubstituteForInternalMemberCodeFixProvider(); - [Theory] - [MemberData(nameof(DiagnosticIndicesTestCases))] - public abstract Task AppendsInternalsVisibleTo_ToTopLevelCompilationUnit_WhenUsedWithInternalClass(int diagnosticIndex); + [Fact] + public abstract Task AppendsInternalsVisibleTo_ToTopLevelCompilationUnit_WhenUsedWithInternalClass(); - [Theory] - [MemberData(nameof(DiagnosticIndicesTestCases))] - public abstract Task AppendsInternalsVisibleTo_WhenUsedWithInternalClass(int diagnosticIndex); + [Fact] + public abstract Task AppendsInternalsVisibleTo_WhenUsedWithInternalClass(); - [Theory] - [MemberData(nameof(DiagnosticIndicesTestCases))] - public abstract Task AppendsInternalsVisibleTo_WhenUsedWithInternalClass_AndArgumentListNotEmpty(int diagnosticIndex); + [Fact] + public abstract Task AppendsInternalsVisibleTo_WhenUsedWithInternalClass_AndArgumentListNotEmpty(); - [Theory] - [MemberData(nameof(DiagnosticIndicesTestCases))] - public abstract Task AppendsInternalsVisibleTo_WhenUsedWithNestedInternalClass(int diagnosticIndex); + [Fact] + public abstract Task AppendsInternalsVisibleTo_WhenUsedWithNestedInternalClass(); [Fact] public abstract Task DoesNot_AppendsInternalsVisibleTo_WhenUsedWithPublicClass(); diff --git a/tests/NSubstitute.Analyzers.Tests.VisualBasic/DiagnosticAnalyzersTests/ConflictingArgumentAssignmentsAnalyzerTests/ReturnsAsOrdinaryMethodTests.cs b/tests/NSubstitute.Analyzers.Tests.VisualBasic/DiagnosticAnalyzersTests/ConflictingArgumentAssignmentsAnalyzerTests/ReturnsAsOrdinaryMethodTests.cs index d3d239d6..f6e2b5c7 100644 --- a/tests/NSubstitute.Analyzers.Tests.VisualBasic/DiagnosticAnalyzersTests/ConflictingArgumentAssignmentsAnalyzerTests/ReturnsAsOrdinaryMethodTests.cs +++ b/tests/NSubstitute.Analyzers.Tests.VisualBasic/DiagnosticAnalyzersTests/ConflictingArgumentAssignmentsAnalyzerTests/ReturnsAsOrdinaryMethodTests.cs @@ -118,6 +118,24 @@ Return 1 Function(callInfo) callInfo(0) = 1 End Function) + {method}(value:= substitute.Bar(Arg.Any(Of Integer)()), returnThis:= Function(callInfo) + callInfo(0) = 1 + Return 1 + End Function).AndDoes(Function(callInfo) + callInfo(0) = 1 + End Function, + Function(callInfo) + callInfo(0) = 1 + End Function) + {method}(returnThis:= Function(callInfo) + callInfo(0) = 1 + Return 1 + End Function, value:= substitute.Bar(Arg.Any(Of Integer)())).AndDoes(Function(callInfo) + callInfo(0) = 1 + End Function, + Function(callInfo) + callInfo(0) = 1 + End Function) End Sub End Class diff --git a/tests/NSubstitute.Analyzers.Tests.VisualBasic/DiagnosticAnalyzersTests/ConflictingArgumentAssignmentsAnalyzerTests/ThrowsAsOrdinaryMethodTests.cs b/tests/NSubstitute.Analyzers.Tests.VisualBasic/DiagnosticAnalyzersTests/ConflictingArgumentAssignmentsAnalyzerTests/ThrowsAsOrdinaryMethodTests.cs index c2126e96..35eca1f2 100644 --- a/tests/NSubstitute.Analyzers.Tests.VisualBasic/DiagnosticAnalyzersTests/ConflictingArgumentAssignmentsAnalyzerTests/ThrowsAsOrdinaryMethodTests.cs +++ b/tests/NSubstitute.Analyzers.Tests.VisualBasic/DiagnosticAnalyzersTests/ConflictingArgumentAssignmentsAnalyzerTests/ThrowsAsOrdinaryMethodTests.cs @@ -122,6 +122,24 @@ Return New Exception() Function(callInfo) callInfo(0) = 1 End Function) + {method}(value:= substitute.Bar(Arg.Any(Of Integer)()), createException:= Function(callInfo) + callInfo(0) = 1 + Return New Exception() + End Function).AndDoes(Function(callInfo) + callInfo(0) = 1 + End Function, + Function(callInfo) + callInfo(0) = 1 + End Function) + {method}(createException:= Function(callInfo) + callInfo(0) = 1 + Return New Exception() + End Function, value:= substitute.Bar(Arg.Any(Of Integer)())).AndDoes(Function(callInfo) + callInfo(0) = 1 + End Function, + Function(callInfo) + callInfo(0) = 1 + End Function) End Sub End Class diff --git a/tests/NSubstitute.Analyzers.Tests.VisualBasic/DiagnosticAnalyzersTests/NonSubstitutableMemberReceivedAnalyzerTests/ReceivedAsOrdinaryMethodTests.cs b/tests/NSubstitute.Analyzers.Tests.VisualBasic/DiagnosticAnalyzersTests/NonSubstitutableMemberReceivedAnalyzerTests/ReceivedAsOrdinaryMethodTests.cs index 686d5cc6..ecfbc5e6 100644 --- a/tests/NSubstitute.Analyzers.Tests.VisualBasic/DiagnosticAnalyzersTests/NonSubstitutableMemberReceivedAnalyzerTests/ReceivedAsOrdinaryMethodTests.cs +++ b/tests/NSubstitute.Analyzers.Tests.VisualBasic/DiagnosticAnalyzersTests/NonSubstitutableMemberReceivedAnalyzerTests/ReceivedAsOrdinaryMethodTests.cs @@ -493,17 +493,41 @@ End Class [CombinatoryData( "ReceivedExtensions.Received(substitute, Quantity.None())", + "ReceivedExtensions.Received(substitute:= substitute, x:= Quantity.None())", + "ReceivedExtensions.Received(x:= Quantity.None(), substitute:= substitute)", "ReceivedExtensions.Received(Of Foo)(substitute, Quantity.None())", + "ReceivedExtensions.Received(Of Foo)(substitute:= substitute, x:= Quantity.None())", + "ReceivedExtensions.Received(Of Foo)(x:= Quantity.None(), substitute:= substitute)", "SubstituteExtensions.Received(substitute, 1, 1)", + "SubstituteExtensions.Received(substitute:= substitute, x:= 1, y:= 1)", + "SubstituteExtensions.Received(x:= 1, y:= 1, substitute:= substitute)", "SubstituteExtensions.Received(Of Foo)(substitute, 1, 1)", + "SubstituteExtensions.Received(Of Foo)(substitute:= substitute, x:= 1, y:= 1)", + "SubstituteExtensions.Received(Of Foo)(x:= 1, y:= 1, substitute:= substitute)", "ReceivedExtensions.ReceivedWithAnyArgs(substitute, Quantity.None())", + "ReceivedExtensions.ReceivedWithAnyArgs(substitute:= substitute, x:= Quantity.None())", + "ReceivedExtensions.ReceivedWithAnyArgs(x:= Quantity.None(), substitute:= substitute)", "ReceivedExtensions.ReceivedWithAnyArgs(Of Foo)(substitute, Quantity.None())", + "ReceivedExtensions.ReceivedWithAnyArgs(Of Foo)(substitute:= substitute, x:= Quantity.None())", + "ReceivedExtensions.ReceivedWithAnyArgs(Of Foo)(x:= Quantity.None(), substitute:= substitute)", "SubstituteExtensions.ReceivedWithAnyArgs(substitute, 1, 1)", + "SubstituteExtensions.ReceivedWithAnyArgs(substitute:= substitute, x:= 1, y:= 1)", + "SubstituteExtensions.ReceivedWithAnyArgs(x:= 1, y:= 1, substitute:= substitute)", "SubstituteExtensions.ReceivedWithAnyArgs(Of Foo)(substitute, 1, 1)", + "SubstituteExtensions.ReceivedWithAnyArgs(Of Foo)(substitute:= substitute, x:= 1, y:= 1)", + "SubstituteExtensions.ReceivedWithAnyArgs(Of Foo)(x:= 1, y:= 1, substitute:= substitute)", "SubstituteExtensions.DidNotReceive(substitute, 1, 1)", + "SubstituteExtensions.DidNotReceive(substitute:= substitute, x:= 1, y:= 1)", + "SubstituteExtensions.DidNotReceive(x:= 1, y:= 1, substitute:= substitute)", "SubstituteExtensions.DidNotReceive(Of Foo)(substitute, 1, 1)", + "SubstituteExtensions.DidNotReceive(Of Foo)(substitute:= substitute, x:= 1, y:= 1)", + "SubstituteExtensions.DidNotReceive(Of Foo)(x:= 1, y:= 1, substitute:= substitute)", "SubstituteExtensions.DidNotReceiveWithAnyArgs(substitute, 1, 1)", - "SubstituteExtensions.DidNotReceiveWithAnyArgs(Of Foo)(substitute, 1, 1)")] + "SubstituteExtensions.DidNotReceiveWithAnyArgs(substitute:= substitute, x:= 1, y:= 1)", + "SubstituteExtensions.DidNotReceiveWithAnyArgs(x:= 1, y:= 1, substitute:= substitute)", + "SubstituteExtensions.DidNotReceiveWithAnyArgs(Of Foo)(substitute, 1, 1)", + "SubstituteExtensions.DidNotReceiveWithAnyArgs(Of Foo)(substitute:= substitute, x:= 1, y:= 1)", + "SubstituteExtensions.DidNotReceiveWithAnyArgs(Of Foo)(x:= 1, y:= 1, substitute:= substitute)")] public override async Task ReportsNoDiagnostics_WhenUsingUnfortunatelyNamedMethod(string method) { var source = $@"Imports System.Runtime.CompilerServices diff --git a/tests/NSubstitute.Analyzers.Tests.VisualBasic/DiagnosticAnalyzersTests/NonSubstitutableMemberWhenAnalyzerTests/WhenAsOrdinaryMethodTests.cs b/tests/NSubstitute.Analyzers.Tests.VisualBasic/DiagnosticAnalyzersTests/NonSubstitutableMemberWhenAnalyzerTests/WhenAsOrdinaryMethodTests.cs index 26d5c5f1..e5d56e09 100644 --- a/tests/NSubstitute.Analyzers.Tests.VisualBasic/DiagnosticAnalyzersTests/NonSubstitutableMemberWhenAnalyzerTests/WhenAsOrdinaryMethodTests.cs +++ b/tests/NSubstitute.Analyzers.Tests.VisualBasic/DiagnosticAnalyzersTests/NonSubstitutableMemberWhenAnalyzerTests/WhenAsOrdinaryMethodTests.cs @@ -343,6 +343,8 @@ Public Class FooTests Public Sub Test() Dim substitute As Foo = Nothing {method}(substitute, {whenAction}, 1) + {method}(substitute:= substitute, substituteCall:= {whenAction}, x:= 1) + {method}(substituteCall:= {whenAction}, x:= 1, substitute:= substitute) End Sub End Class End Namespace diff --git a/tests/NSubstitute.Analyzers.Tests.VisualBasic/DiagnosticAnalyzersTests/ReceivedInReceivedInOrderAnalyzerTests/ReceivedAsOrdinaryMethodTests.cs b/tests/NSubstitute.Analyzers.Tests.VisualBasic/DiagnosticAnalyzersTests/ReceivedInReceivedInOrderAnalyzerTests/ReceivedAsOrdinaryMethodTests.cs index 9d6cb281..c0293a40 100644 --- a/tests/NSubstitute.Analyzers.Tests.VisualBasic/DiagnosticAnalyzersTests/ReceivedInReceivedInOrderAnalyzerTests/ReceivedAsOrdinaryMethodTests.cs +++ b/tests/NSubstitute.Analyzers.Tests.VisualBasic/DiagnosticAnalyzersTests/ReceivedInReceivedInOrderAnalyzerTests/ReceivedAsOrdinaryMethodTests.cs @@ -139,17 +139,40 @@ End Namespace [CombinatoryData( "ReceivedExtensions.Received(substitute, Quantity.None())", + "ReceivedExtensions.Received(substitute:= substitute, x:= Quantity.None())", + "ReceivedExtensions.Received(x:= Quantity.None(), substitute:= substitute)", "ReceivedExtensions.Received(Of Foo)(substitute, Quantity.None())", + "ReceivedExtensions.Received(Of Foo)(substitute:= substitute, x: =Quantity.None())", + "ReceivedExtensions.Received(Of Foo)(x:= Quantity.None(), substitute:= substitute)", "SubstituteExtensions.Received(substitute, 1, 1)", + "SubstituteExtensions.Received(substitute:= substitute, x:= 1, y:= 1)", + "SubstituteExtensions.Received(x:= 1, y:= 1, substitute:= substitute)", "SubstituteExtensions.Received(Of Foo)(substitute, 1, 1)", + "SubstituteExtensions.Received(Of Foo)(substitute:= substitute, x:= 1, y:= 1)", + "SubstituteExtensions.Received(Of Foo)(x:= 1, y:= 1, substitute:= substitute)", "ReceivedExtensions.ReceivedWithAnyArgs(substitute, Quantity.None())", + "ReceivedExtensions.ReceivedWithAnyArgs(substitute:= substitute, x:= Quantity.None())", + "ReceivedExtensions.ReceivedWithAnyArgs(x:= Quantity.None(), substitute:= substitute)", "ReceivedExtensions.ReceivedWithAnyArgs(Of Foo)(substitute, Quantity.None())", + "ReceivedExtensions.ReceivedWithAnyArgs(Of Foo)(substitute:= substitute, x:= Quantity.None())", + "ReceivedExtensions.ReceivedWithAnyArgs(Of Foo)(x:= Quantity.None(), substitute:= substitute)", "SubstituteExtensions.ReceivedWithAnyArgs(substitute, 1, 1)", + "SubstituteExtensions.ReceivedWithAnyArgs(substitute:= substitute, x:= 1, y:= 1)", + "SubstituteExtensions.ReceivedWithAnyArgs(x:= 1, y:= 1, substitute:= substitute)", "SubstituteExtensions.ReceivedWithAnyArgs(Of Foo)(substitute, 1, 1)", + "SubstituteExtensions.ReceivedWithAnyArgs(Of Foo)(substitute:= substitute, x:= 1, y:= 1)", "SubstituteExtensions.DidNotReceive(substitute, 1, 1)", + "SubstituteExtensions.DidNotReceive(substitute:= substitute, x:= 1, y:= 1)", + "SubstituteExtensions.DidNotReceive(x:= 1, y:= 1, substitute:= substitute)", "SubstituteExtensions.DidNotReceive(Of Foo)(substitute, 1, 1)", + "SubstituteExtensions.DidNotReceive(Of Foo)(substitute:= substitute, x:= 1, y:= 1)", + "SubstituteExtensions.DidNotReceive(Of Foo)(x:= 1, y:= 1, substitute:= substitute)", "SubstituteExtensions.DidNotReceiveWithAnyArgs(substitute, 1, 1)", - "SubstituteExtensions.DidNotReceiveWithAnyArgs(Of Foo)(substitute, 1, 1)")] + "SubstituteExtensions.DidNotReceiveWithAnyArgs(substitute:= substitute, x:= 1, y:= 1)", + "SubstituteExtensions.DidNotReceiveWithAnyArgs(x:= 1, y:= 1, substitute:= substitute)", + "SubstituteExtensions.DidNotReceiveWithAnyArgs(Of Foo)(substitute, 1, 1)", + "SubstituteExtensions.DidNotReceiveWithAnyArgs(Of Foo)(substitute:= substitute, x:= 1, y:= 1)", + "SubstituteExtensions.DidNotReceiveWithAnyArgs(Of Foo)(x:= 1, y:= 1, substitute:= substitute)")] public override async Task ReportsNoDiagnostics_WhenUsingUnfortunatelyNamedMethod(string method) { var source = $@"Imports System diff --git a/tests/NSubstitute.Analyzers.Tests.VisualBasic/DiagnosticAnalyzersTests/UnusedReceivedAnalyzerTests/ReceivedAsOrdinaryMethodTests.cs b/tests/NSubstitute.Analyzers.Tests.VisualBasic/DiagnosticAnalyzersTests/UnusedReceivedAnalyzerTests/ReceivedAsOrdinaryMethodTests.cs index 32d38598..5a38c2dd 100644 --- a/tests/NSubstitute.Analyzers.Tests.VisualBasic/DiagnosticAnalyzersTests/UnusedReceivedAnalyzerTests/ReceivedAsOrdinaryMethodTests.cs +++ b/tests/NSubstitute.Analyzers.Tests.VisualBasic/DiagnosticAnalyzersTests/UnusedReceivedAnalyzerTests/ReceivedAsOrdinaryMethodTests.cs @@ -185,17 +185,40 @@ End Namespace [CombinatoryData( "ReceivedExtensions.Received(substitute, Quantity.None())", + "ReceivedExtensions.Received(substitute:= substitute, x:= Quantity.None())", + "ReceivedExtensions.Received(x:= Quantity.None(), substitute:= substitute)", "ReceivedExtensions.Received(Of Foo)(substitute, Quantity.None())", + "ReceivedExtensions.Received(Of Foo)(substitute:= substitute, x:= Quantity.None())", "SubstituteExtensions.Received(substitute, 1, 1)", + "SubstituteExtensions.Received(substitute:= substitute, x:= 1, y:= 1)", + "SubstituteExtensions.Received(x:= 1, y:= 1, substitute:= substitute)", "SubstituteExtensions.Received(Of Foo)(substitute, 1, 1)", + "SubstituteExtensions.Received(Of Foo)(substitute:= substitute, x:= 1, y:=1)", + "SubstituteExtensions.Received(Of Foo)(x:= 1, y:=1, substitute:= substitute)", "ReceivedExtensions.ReceivedWithAnyArgs(substitute, Quantity.None())", + "ReceivedExtensions.ReceivedWithAnyArgs(substitute:= substitute, x:= Quantity.None())", + "ReceivedExtensions.ReceivedWithAnyArgs(x:= Quantity.None(), substitute:= substitute)", "ReceivedExtensions.ReceivedWithAnyArgs(Of Foo)(substitute, Quantity.None())", + "ReceivedExtensions.ReceivedWithAnyArgs(Of Foo)(substitute:= substitute, x:= Quantity.None())", + "ReceivedExtensions.ReceivedWithAnyArgs(Of Foo)(x:= Quantity.None(), substitute:= substitute)", "SubstituteExtensions.ReceivedWithAnyArgs(substitute, 1, 1)", + "SubstituteExtensions.ReceivedWithAnyArgs(substitute:= substitute, x:= 1, y:= 1)", + "SubstituteExtensions.ReceivedWithAnyArgs(x:= 1, y:= 1, substitute:= substitute)", "SubstituteExtensions.ReceivedWithAnyArgs(Of Foo)(substitute, 1, 1)", + "SubstituteExtensions.ReceivedWithAnyArgs(Of Foo)(substitute:= substitute, x:= 1, y:= 1)", + "SubstituteExtensions.ReceivedWithAnyArgs(Of Foo)(x:= 1, y:= 1, substitute:= substitute)", "SubstituteExtensions.DidNotReceive(substitute, 1, 1)", + "SubstituteExtensions.DidNotReceive(substitute:= substitute, x:= 1, y:= 1)", + "SubstituteExtensions.DidNotReceive(x:= 1, y:= 1, substitute:= substitute)", "SubstituteExtensions.DidNotReceive(Of Foo)(substitute, 1, 1)", + "SubstituteExtensions.DidNotReceive(Of Foo)(substitute:= substitute, x:= 1, y:= 1)", + "SubstituteExtensions.DidNotReceive(Of Foo)(x:= 1, y:= 1, substitute:= substitute)", "SubstituteExtensions.DidNotReceiveWithAnyArgs(substitute, 1, 1)", - "SubstituteExtensions.DidNotReceiveWithAnyArgs(Of Foo)(substitute, 1, 1)")] + "SubstituteExtensions.DidNotReceiveWithAnyArgs(substitute:= substitute, x:= 1, y:= 1)", + "SubstituteExtensions.DidNotReceiveWithAnyArgs(x:= 1, y:= 1, substitute:= substitute)", + "SubstituteExtensions.DidNotReceiveWithAnyArgs(Of Foo)(substitute, 1, 1)", + "SubstituteExtensions.DidNotReceiveWithAnyArgs(Of Foo)(substitute:= substitute, x:= 1, y:= 1)", + "SubstituteExtensions.DidNotReceiveWithAnyArgs(Of Foo)(x:= 1, y:= 1, substitute:= substitute)")] public override async Task ReportsNoDiagnostics_WhenUsedWithUnfortunatelyNamedMethod(string method) { var source = $@"Imports System