-Changed BsonReader/BsonWriter to close the underlying stream by default when closed
-Added CloseInput/CloseOutput to JsonReader/JsonWriter to control whether the underlying stream is closed. Default to true
This commit is contained in:
@@ -35,6 +35,24 @@ namespace Newtonsoft.Json.Tests
|
||||
{
|
||||
public class JsonTextReaderTest : TestFixtureBase
|
||||
{
|
||||
[Test]
|
||||
public void CloseInput()
|
||||
{
|
||||
MemoryStream ms = new MemoryStream();
|
||||
JsonTextReader reader = new JsonTextReader(new StreamReader(ms));
|
||||
|
||||
Assert.IsTrue(ms.CanRead);
|
||||
reader.Close();
|
||||
Assert.IsFalse(ms.CanRead);
|
||||
|
||||
ms = new MemoryStream();
|
||||
reader = new JsonTextReader(new StreamReader(ms)) { CloseInput = false };
|
||||
|
||||
Assert.IsTrue(ms.CanRead);
|
||||
reader.Close();
|
||||
Assert.IsTrue(ms.CanRead);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void YahooFinance()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user