-
Notifications
You must be signed in to change notification settings - Fork 52
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8524021
commit df50c2f
Showing
4 changed files
with
46 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
...it.DependencyPropertyGenerator.Tests/Helpers/CSharpCodeFixerTest{TAnalyzer,TCodeFixer}.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
// See the LICENSE file in the project root for more information. | ||
|
||
using Microsoft.CodeAnalysis.CSharp; | ||
using Microsoft.CodeAnalysis.Diagnostics; | ||
using Microsoft.CodeAnalysis.Testing; | ||
using Microsoft.CodeAnalysis; | ||
using Microsoft.CodeAnalysis.CodeFixes; | ||
using Microsoft.CodeAnalysis.CSharp.Testing; | ||
|
||
namespace CommunityToolkit.GeneratedDependencyProperty.Tests.Helpers; | ||
|
||
/// <summary> | ||
/// A custom <see cref="CSharpCodeFixTest{TAnalyzer, TCodeFix, TVerifier}"/> that uses a specific C# language version to parse code. | ||
/// </summary> | ||
/// <typeparam name="TAnalyzer">The type of the analyzer to produce diagnostics.</typeparam> | ||
/// <typeparam name="TCodeFixer">The type of code fix to test.</typeparam> | ||
internal sealed class CSharpCodeFixTest<TAnalyzer, TCodeFixer> : CSharpCodeFixTest<TAnalyzer, TCodeFixer, DefaultVerifier> | ||
where TAnalyzer : DiagnosticAnalyzer, new() | ||
where TCodeFixer : CodeFixProvider, new() | ||
{ | ||
/// <summary> | ||
/// The C# language version to use to parse code. | ||
/// </summary> | ||
private readonly LanguageVersion languageVersion; | ||
|
||
/// <summary> | ||
/// Creates a new <see cref="CSharpCodeFixWithLanguageVersionTest{TAnalyzer, TCodeFix, TVerifier}"/> instance with the specified parameters. | ||
/// </summary> | ||
/// <param name="languageVersion">The C# language version to use to parse code.</param> | ||
public CSharpCodeFixTest(LanguageVersion languageVersion) | ||
{ | ||
this.languageVersion = languageVersion; | ||
} | ||
|
||
/// <inheritdoc/> | ||
protected override ParseOptions CreateParseOptions() | ||
{ | ||
return new CSharpParseOptions(this.languageVersion, DocumentationMode.Diagnose); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters