Skip to content

Commit a9b3430

Browse files
committed
Merge branch 'release/0.15.0'
2 parents f358392 + a90b59e commit a9b3430

5 files changed

Lines changed: 27 additions & 8 deletions

File tree

.travis.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,12 @@ osx_image: xcode9.2
1313
mono:
1414
- 4.4.2
1515

16-
dotnet: 2.1.3
16+
dotnet: 3.0.100
1717

1818
before_install:
1919
- git fetch --unshallow # Travis always does a shallow clone, but GitVersion needs the full history including branches and tags
2020
- git config remote.origin.fetch "+refs/heads/*:refs/remotes/origin/*"
21-
- git fetch origin
21+
- git fetch origin
2222

2323
script:
2424
- ./build.sh --target=Test

build.config

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
#!/usr/bin/env bash
2-
CAKE_VERSION=0.34.1
3-
DOTNET_VERSION=3.0.100-rc1-014190
2+
CAKE_VERSION=0.35.0
3+
DOTNET_VERSION=3.0.100

global.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@
33
"src"
44
],
55
"sdk": {
6-
"version": "3.0.100-rc1-014190"
6+
"version": "3.0.100"
77
}
88
}

src/LitJson/JsonMapper.cs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -779,10 +779,13 @@ private static void WriteValue (object obj, JsonWriter writer,
779779
return;
780780
}
781781

782-
if (obj is IDictionary) {
782+
if (obj is IDictionary dictionary) {
783783
writer.WriteObjectStart ();
784-
foreach (DictionaryEntry entry in (IDictionary) obj) {
785-
writer.WritePropertyName ((string) entry.Key);
784+
foreach (DictionaryEntry entry in dictionary) {
785+
var propertyName = entry.Key is string key ?
786+
key
787+
: Convert.ToString(entry.Key, CultureInfo.InvariantCulture);
788+
writer.WritePropertyName (propertyName);
786789
WriteValue (entry.Value, writer, writer_is_private,
787790
depth + 1);
788791
}

test/JsonMapperTest.cs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -306,6 +306,22 @@ public void ExportEnumsTest ()
306306
Assert.AreEqual ("{\"FavouritePlanet\":1,\"Band\":9}", json);
307307
}
308308

309+
[Test]
310+
public void ExportEnumDictionaryTest()
311+
{
312+
Dictionary<Planets, int> planets = new Dictionary<Planets, int>();
313+
314+
planets.Add(Planets.Jupiter, 5);
315+
planets.Add(Planets.Saturn, 6);
316+
planets.Add(Planets.Uranus, 7);
317+
planets.Add(Planets.Neptune, 8);
318+
planets.Add(Planets.Pluto, 9);
319+
320+
string json = JsonMapper.ToJson(planets);
321+
322+
Assert.AreEqual("{\"Jupiter\":5,\"Saturn\":6,\"Uranus\":7,\"Neptune\":8,\"Pluto\":9}", json);
323+
}
324+
309325
[Test]
310326
public void ExportObjectTest ()
311327
{

0 commit comments

Comments
 (0)