Skip to content

Commit

Permalink
-Tests
Browse files Browse the repository at this point in the history
  • Loading branch information
JamesNK committed Jun 11, 2017
1 parent 4467bdb commit 59cd89a
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions Src/Newtonsoft.Json.Tests/Converters/StringEnumConverterTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -637,6 +637,28 @@ public void AllowIntegerValueAndNegativeStringNumber()
Assert.AreEqual("Integer string '-1' is not allowed.", ex.InnerException.Message);
}

[Test]
public void AllowIntegerValueAndPositiveStringNumber()
{
JsonSerializationException ex = ExceptionAssert.Throws<JsonSerializationException>(() =>
{
JsonConvert.DeserializeObject<StoreColor>("\"+1\"", new StringEnumConverter { AllowIntegerValues = false });
});

Assert.AreEqual("Integer string '+1' is not allowed.", ex.InnerException.Message);
}

[Test]
public void AllowIntegerValueAndDash()
{
JsonSerializationException ex = ExceptionAssert.Throws<JsonSerializationException>(() =>
{
JsonConvert.DeserializeObject<StoreColor>("\"-\"", new StringEnumConverter { AllowIntegerValues = false });
});

Assert.AreEqual("Requested value '-' was not found.", ex.InnerException.Message);
}

[Test]
public void AllowIntegerValueAndNonNamedValue()
{
Expand Down

0 comments on commit 59cd89a

Please sign in to comment.