MapTo/test/MapTo.Tests/Infrastructure/TestAnalyzerConfigOptions.cs

19 lines
701 B
C#
Raw Permalink Normal View History

2021-01-03 12:26:07 +03:00
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Diagnostics.CodeAnalysis;
using Microsoft.CodeAnalysis.Diagnostics;
namespace MapTo.Tests.Infrastructure
{
internal sealed class TestAnalyzerConfigOptions : AnalyzerConfigOptions
{
private readonly ImmutableDictionary<string, string> _backing;
2021-06-29 09:14:00 +03:00
public TestAnalyzerConfigOptions(IDictionary<string, string>? properties)
2021-01-03 12:26:07 +03:00
{
_backing = properties?.ToImmutableDictionary(KeyComparer) ?? ImmutableDictionary.Create<string, string>(KeyComparer);
}
2021-06-30 21:16:28 +03:00
public override bool TryGetValue(string key, out string? value) => _backing.TryGetValue(key, out value);
2021-01-03 12:26:07 +03:00
}
}