Skip to content
This repository has been archived by the owner on Dec 24, 2022. It is now read-only.

Commit

Permalink
Fix FromObjectDictionary
Browse files Browse the repository at this point in the history
  • Loading branch information
mythz committed Oct 4, 2018
1 parent 17325a1 commit f24e7a1
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/ServiceStack.Text/PlatformExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -665,9 +665,9 @@ public static object FromObjectDictionary(this IReadOnlyDictionary<string, objec
if (values == null)
return null;

var alreadyDict = type == typeof(IReadOnlyDictionary<string, object>);
var alreadyDict = typeof(IReadOnlyDictionary<string, object>).IsAssignableFrom(type);
if (alreadyDict)
return true;
return values;

var to = type.CreateInstance();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -397,6 +397,13 @@ public void Can_use_PopulateInstance_to_populate_enum()
Assert.That(config.CefSettings.LogSeverity, Is.EqualTo(CefLogSeverity.Verbose));
}

[Test]
public void Can_convert_Dictionary_FromObjectDictionary()
{
var dict = new Dictionary<string,object>();
var to = dict.FromObjectDictionary<Dictionary<string, object>>();
Assert.That(to == dict);
}

}

Expand Down

0 comments on commit f24e7a1

Please sign in to comment.