This commit is contained in:
James Newton-King
2017-06-11 15:56:10 +12:00
parent 4467bdb224
commit 59cd89a140
@@ -637,6 +637,28 @@ namespace Newtonsoft.Json.Tests.Converters
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()
{