Make JsonValidatingReader close underlying reader

Add `Close` method override in `JsonValidatingReader` so that the
`CloseInput` property is observed properly. Also add a corresponding
unit test.
This commit is contained in:
stakx
2016-12-26 12:21:45 +01:00
parent ee5a229922
commit 7644768580
9 changed files with 74 additions and 0 deletions
@@ -1747,6 +1747,17 @@ namespace Newtonsoft.Json.Tests
Assert.AreEqual(JsonToken.None, reader.TokenType);
Assert.AreEqual(null, validationEventArgs);
}
[Test]
public void CloseAlsoClosesUnderlyingReader()
{
var underlyingReader = new TestObjects.JsonReaderStubWithIsClosed();
var validatingReader = new JsonValidatingReader(underlyingReader) { CloseInput = true };
validatingReader.Close();
Assert.IsTrue(underlyingReader.IsClosed);
}
}
}