-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:
JamesNK
2011-03-22 05:48:52 +00:00
parent 6f0c382ba7
commit 6a49425267
11 changed files with 122 additions and 3 deletions
@@ -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()
{