-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTestAnalyzerConfigOptions.cs
More file actions
27 lines (22 loc) · 938 Bytes
/
TestAnalyzerConfigOptions.cs
File metadata and controls
27 lines (22 loc) · 938 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
namespace NetEvolve.Pulse.SourceGeneration.Tests.Unit;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using Microsoft.CodeAnalysis.Diagnostics;
/// <summary>
/// Test implementation of <see cref="AnalyzerConfigOptions"/> backed by a dictionary.
/// </summary>
internal sealed class TestAnalyzerConfigOptions : AnalyzerConfigOptions
{
public static readonly TestAnalyzerConfigOptions Empty = new(rootNamespace: null);
private readonly Dictionary<string, string> _options;
public TestAnalyzerConfigOptions(string? rootNamespace)
{
_options = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
if (rootNamespace is not null)
{
_options["build_property.RootNamespace"] = rootNamespace;
}
}
public override bool TryGetValue(string key, [NotNullWhen(true)] out string? value) =>
_options.TryGetValue(key, out value);
}