public void TestAbuseClosedIndexInput() { using MockDirectoryWrapper dir = NewMockDirectory(); using (IndexOutput @out = dir.CreateOutput("foo", IOContext.DEFAULT)) { @out.WriteByte((byte)42); } // @out.close(); IndexInput @in = dir.OpenInput("foo", IOContext.DEFAULT); @in.Dispose(); Assert.Throws <LuceneSystemException>(() => @in.ReadByte()); }