public void TestReaderDispose() { using (var stream = new MemoryStream()) using (var writer = new StreamWriter(stream)) using (var reader = new StreamReader(stream)) { var dtReader = new DelimitedTextReader(reader); writer.Write(headerLine); writer.Write(dataLine1); writer.Flush(); stream.Position = 0; using (var dataReader = new DelimitedTextDataReader(dtReader)) { dataReader.Read(); Assert.Equal("Son of a beach!", dataReader["StringField"]); } dtReader.Dispose(); Assert.Null(dtReader.Parser); } }