Skip to content

Add ISource to handle IReadOnlyDictionary<TKey, TValue> #342

Closed Answered by axunonb
dombrovsky asked this question in Q&A
Discussion options

You must be logged in to vote

You're saying that this tests fails for SmartFormat v3.2.1?

[Test]
public void ReadOnlyDictionaryTest()
{
    var dict = new Dictionary<string, object> { { "One", 1 }, { "Two", 2 }, { "Three", 3 }, };
    var roDict = new ReadOnlyDictionary<string, object>(dict);

    var formatter = Smart.CreateDefaultSmartFormat();
    var result = formatter.Format("{One}{Two}{Three}", roDict);

    Assert.That(result, Is.EqualTo("123"));
}

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
1 reply
@dombrovsky
Comment options

Answer selected by axunonb
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
2 participants
Converted from issue

This discussion was converted from issue #340 on July 20, 2023 21:27.