Skip to content

Commit bd39877

Browse files
committed
Rename property IsIReadOnlyDictionaryEnabled to IsIReadOnlyDictionarySupported
1 parent 509c990 commit bd39877

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

src/SmartFormat.Tests/Extensions/DictionarySourceTests.cs

+3-3
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ public void IReadOnlyDictionary_With_IConvertible_Key()
177177
{
178178
var roDict = new CustomReadOnlyDictionary<IConvertible, object?>(new Dictionary<IConvertible, object?> { { 1, 1 }, { "Two", 2 }, { "Three", "three" }, });
179179
var smart = new SmartFormatter()
180-
.AddExtensions(new DefaultSource(), new DictionarySource { IsIReadOnlyDictionaryEnabled = true })
180+
.AddExtensions(new DefaultSource(), new DictionarySource { IsIReadOnlyDictionarySupported = true })
181181
.AddExtensions(new DefaultFormatter());
182182
var result = smart.Format("{1}{Two}{Three}", roDict);
183183

@@ -189,7 +189,7 @@ public void IReadOnlyDictionary_With_String_Key()
189189
{
190190
var roDict = new CustomReadOnlyDictionary<string, object?>(new Dictionary<string, object?> { { "One", 1 }, { "Two", 2 }, { "Three", "three" }, });
191191
var smart = new SmartFormatter()
192-
.AddExtensions(new DefaultSource(), new DictionarySource { IsIReadOnlyDictionaryEnabled = true })
192+
.AddExtensions(new DefaultSource(), new DictionarySource { IsIReadOnlyDictionarySupported = true })
193193
.AddExtensions(new DefaultFormatter());
194194
var result = smart.Format("{One}{Two}{Three}", roDict);
195195

@@ -199,7 +199,7 @@ public void IReadOnlyDictionary_With_String_Key()
199199
[Test]
200200
public void IReadOnlyDictionary_Cache_Should_Store_Types_It_Cannot_Handle()
201201
{
202-
var dictSource = new DictionarySource { IsIReadOnlyDictionaryEnabled = true };
202+
var dictSource = new DictionarySource { IsIReadOnlyDictionarySupported = true };
203203
var kvp = new KeyValuePair<string, object?>("One", 1);
204204
var smart = new SmartFormatter()
205205
.AddExtensions(new DefaultSource(), dictSource, new KeyValuePairSource())

src/SmartFormat/Extensions/DictionarySource.cs

+3-3
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ namespace SmartFormat.Extensions;
1818
/// and <see cref="IReadOnlyDictionary{TKey,TValue}"/>.
1919
/// Include this source, if any of these types shall be used.
2020
/// <para/>
21-
/// For support of <see cref="IReadOnlyDictionary{TKey,TValue}"/> <see cref="IsIReadOnlyDictionaryEnabled"/> must be set to <see langword="true"/>.
21+
/// For support of <see cref="IReadOnlyDictionary{TKey,TValue}"/> <see cref="IsIReadOnlyDictionarySupported"/> must be set to <see langword="true"/>.
2222
/// This uses Reflection and is slower than the other types despite caching.
2323
/// </summary>
2424
public class DictionarySource : Source
@@ -59,7 +59,7 @@ public override bool TryEvaluateSelector(ISelectorInfo selectorInfo)
5959
}
6060

6161
// This is for IReadOnlyDictionary<,> using Reflection
62-
if (IsIReadOnlyDictionaryEnabled && TryGetDictionaryValue(current, selector,
62+
if (IsIReadOnlyDictionarySupported && TryGetDictionaryValue(current, selector,
6363
selectorInfo.FormatDetails.Settings.GetCaseSensitivityComparison(), out var value))
6464
{
6565
selectorInfo.Result = value;
@@ -89,7 +89,7 @@ public override bool TryEvaluateSelector(ISelectorInfo selectorInfo)
8989
/// Although caching is used, this is still slower than the other types.
9090
/// Default is <see langword="false"/>.
9191
/// </summary>
92-
public bool IsIReadOnlyDictionaryEnabled { get; set; } = false;
92+
public bool IsIReadOnlyDictionarySupported { get; set; } = false;
9393

9494
private bool TryGetDictionaryValue(object obj, string key, StringComparison comparison, out object? value)
9595
{

0 commit comments

Comments
 (0)