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.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();