Skip to content

Commit

Permalink
Merge branch 'users/askagarw/RegionsContacted' of https://github.com/…
Browse files Browse the repository at this point in the history
…Azure/azure-cosmos-dotnet-v3 into users/askagarw/RegionsContacted
  • Loading branch information
asketagarwal committed Mar 16, 2021
2 parents 0ea080a + 8999c75 commit 97dd07d
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@ public override object ReadJson(
}

JToken typeToken = token["type"];
if (typeToken.Type != JTokenType.String)
if (typeToken == null
|| typeToken.Type != JTokenType.String)
{
throw new JsonSerializationException(RMResources.SpatialInvalidGeometryType);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,17 @@ public void TestInvalidJson()
Point point = JsonConvert.DeserializeObject<Point>(json);
}

/// <summary>
/// Tests that no type throws exception.
/// </summary>
[TestMethod]
[ExpectedException(typeof(JsonSerializationException))]
public void TestNoType()
{
string json = @"{""notatype"":""nothingrelevant""}";
Point point = JsonConvert.DeserializeObject<Point>(json);
}

/// <summary>
/// Tests that coordinates cannot be null.
/// </summary>
Expand Down

0 comments on commit 97dd07d

Please sign in to comment.