-Added GetValue and TryGetValue with StringComparison to JObject
-Fixed SecAnnotate warnings -Fixed error when comparing empty JObjects -Fixed error when comparing DateTime JValue with a DateTimeOffset JValue
This commit is contained in:
@@ -2533,24 +2533,51 @@ bye", reader.Value);
|
||||
//Assert.IsFalse(jsonTextReader.Read());
|
||||
}
|
||||
|
||||
public class ToggleReaderError : TextReader
|
||||
[Test]
|
||||
public void WriteReadBoundaryDecimals()
|
||||
{
|
||||
private readonly TextReader _inner;
|
||||
StringWriter sw = new StringWriter();
|
||||
JsonTextWriter writer = new JsonTextWriter(sw);
|
||||
|
||||
public bool Error { get; set; }
|
||||
writer.WriteStartArray();
|
||||
writer.WriteValue(decimal.MaxValue);
|
||||
writer.WriteValue(decimal.MinValue);
|
||||
writer.WriteEndArray();
|
||||
|
||||
public ToggleReaderError(TextReader inner)
|
||||
{
|
||||
_inner = inner;
|
||||
}
|
||||
string json = sw.ToString();
|
||||
|
||||
public override int Read(char[] buffer, int index, int count)
|
||||
{
|
||||
if (Error)
|
||||
throw new Exception("Read error");
|
||||
StringReader sr = new StringReader(json);
|
||||
JsonTextReader reader = new JsonTextReader(sr);
|
||||
|
||||
return _inner.Read(buffer, index, 1);
|
||||
}
|
||||
Assert.IsTrue(reader.Read());
|
||||
|
||||
decimal? max = reader.ReadAsDecimal();
|
||||
Assert.AreEqual(decimal.MaxValue, max);
|
||||
|
||||
decimal? min = reader.ReadAsDecimal();
|
||||
Assert.AreEqual(decimal.MinValue, min);
|
||||
|
||||
Assert.IsTrue(reader.Read());
|
||||
}
|
||||
}
|
||||
|
||||
public class ToggleReaderError : TextReader
|
||||
{
|
||||
private readonly TextReader _inner;
|
||||
|
||||
public bool Error { get; set; }
|
||||
|
||||
public ToggleReaderError(TextReader inner)
|
||||
{
|
||||
_inner = inner;
|
||||
}
|
||||
|
||||
public override int Read(char[] buffer, int index, int count)
|
||||
{
|
||||
if (Error)
|
||||
throw new Exception("Read error");
|
||||
|
||||
return _inner.Read(buffer, index, 1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user