From db953a00e8cc9d0192910e3ee5069d9ee0dae937 Mon Sep 17 00:00:00 2001 From: Tarek Mahmoud Sayed Date: Tue, 12 Sep 2023 15:08:57 -0700 Subject: [PATCH] Rename Options Validator Source Generator --- .../Microsoft.Extensions.Options/gen/Generator.cs | 2 +- .../tests/SourceGeneration.Unit.Tests/Main.cs | 8 ++++---- .../tests/SourceGenerationTests/EmitterTests.cs | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/libraries/Microsoft.Extensions.Options/gen/Generator.cs b/src/libraries/Microsoft.Extensions.Options/gen/Generator.cs index 8fdfc60a82080..34533fc0a96b0 100644 --- a/src/libraries/Microsoft.Extensions.Options/gen/Generator.cs +++ b/src/libraries/Microsoft.Extensions.Options/gen/Generator.cs @@ -13,7 +13,7 @@ namespace Microsoft.Extensions.Options.Generators { [Generator] - public class OptionValidatorGenerator : IIncrementalGenerator + public class OptionsValidatorGenerator : IIncrementalGenerator { public void Initialize(IncrementalGeneratorInitializationContext context) { diff --git a/src/libraries/Microsoft.Extensions.Options/tests/SourceGeneration.Unit.Tests/Main.cs b/src/libraries/Microsoft.Extensions.Options/tests/SourceGeneration.Unit.Tests/Main.cs index 0091f0b672397..aa51c9dfbae73 100644 --- a/src/libraries/Microsoft.Extensions.Options/tests/SourceGeneration.Unit.Tests/Main.cs +++ b/src/libraries/Microsoft.Extensions.Options/tests/SourceGeneration.Unit.Tests/Main.cs @@ -1610,7 +1610,7 @@ public partial class FirstModelValidator : IValidateOptions // Run the generator with C# 7.0 and verify that it fails. var (diagnostics, generatedSources) = await RoslynTestUtils.RunGenerator( - new OptionValidatorGenerator(), refAssemblies.ToArray(), new[] { source }, includeBaseReferences: true, LanguageVersion.CSharp7).ConfigureAwait(false); + new OptionsValidatorGenerator(), refAssemblies.ToArray(), new[] { source }, includeBaseReferences: true, LanguageVersion.CSharp7).ConfigureAwait(false); Assert.NotEmpty(diagnostics); Assert.Equal("SYSLIB1216", diagnostics[0].Id); @@ -1618,7 +1618,7 @@ public partial class FirstModelValidator : IValidateOptions // Run the generator with C# 8.0 and verify that it succeeds. (diagnostics, generatedSources) = await RoslynTestUtils.RunGenerator( - new OptionValidatorGenerator(), refAssemblies.ToArray(), new[] { source }, includeBaseReferences: true, LanguageVersion.CSharp8).ConfigureAwait(false); + new OptionsValidatorGenerator(), refAssemblies.ToArray(), new[] { source }, includeBaseReferences: true, LanguageVersion.CSharp8).ConfigureAwait(false); Assert.Empty(diagnostics); Assert.Single(generatedSources); @@ -1799,7 +1799,7 @@ private static CSharpCompilation CreateCompilationForOptionsSource(string assemb refAssemblies.Add(refAssembly); } - return await RoslynTestUtils.RunGenerator(new OptionValidatorGenerator(), refAssemblies.ToArray(), new List { source }, includeBaseReferences: true, languageVersion).ConfigureAwait(false); + return await RoslynTestUtils.RunGenerator(new OptionsValidatorGenerator(), refAssemblies.ToArray(), new List { source }, includeBaseReferences: true, languageVersion).ConfigureAwait(false); } private static async Task<(IReadOnlyList diagnostics, ImmutableArray generatedSources)> RunGenerator( @@ -1856,7 +1856,7 @@ private static CSharpCompilation CreateCompilationForOptionsSource(string assemb assemblies.Add(Assembly.GetAssembly(typeof(Microsoft.Extensions.Options.ValidateObjectMembersAttribute))!); } - var result = await RoslynTestUtils.RunGenerator(new OptionValidatorGenerator(), assemblies.ToArray(), new[] { text }) + var result = await RoslynTestUtils.RunGenerator(new OptionsValidatorGenerator(), assemblies.ToArray(), new[] { text }) .ConfigureAwait(false); return result; diff --git a/src/libraries/Microsoft.Extensions.Options/tests/SourceGenerationTests/EmitterTests.cs b/src/libraries/Microsoft.Extensions.Options/tests/SourceGenerationTests/EmitterTests.cs index 563157bd2d698..af91cab872c88 100644 --- a/src/libraries/Microsoft.Extensions.Options/tests/SourceGenerationTests/EmitterTests.cs +++ b/src/libraries/Microsoft.Extensions.Options/tests/SourceGenerationTests/EmitterTests.cs @@ -32,7 +32,7 @@ public async Task TestEmitter() } var (d, r) = await RoslynTestUtils.RunGenerator( - new OptionValidatorGenerator(), + new OptionsValidatorGenerator(), new[] { Assembly.GetAssembly(typeof(RequiredAttribute))!,