Lucene.Net.Index.TestIndexReader.TestExceptionReleaseWriteLockJIRA768 C# (CSharp) Method

TestExceptionReleaseWriteLockJIRA768() private method

private TestExceptionReleaseWriteLockJIRA768 ( ) : void
return void
		public virtual void  TestExceptionReleaseWriteLockJIRA768()
		{
			
			Directory dir = new MockRAMDirectory();
			IndexWriter writer = new IndexWriter(dir, new WhitespaceAnalyzer(), true, IndexWriter.MaxFieldLength.LIMITED);
			AddDoc(writer, "aaa");
			writer.Close();
			
			IndexReader reader = IndexReader.Open(dir, false);
		    Assert.Throws<IndexOutOfRangeException>(() => reader.DeleteDocument(1),
		                                            "did not hit exception when deleting an invalid doc number");

			reader.Close();
            Assert.IsFalse(IndexWriter.IsLocked(dir), "write lock is still held after close");
			
			reader = IndexReader.Open(dir, false);
		    Assert.Throws<IndexOutOfRangeException>(() => reader.SetNorm(1, "content", (float) 2.0),
		                                            "did not hit exception when calling setNorm on an invalid doc number");

            reader.Close();
            Assert.IsFalse(IndexWriter.IsLocked(dir), "write lock is still held after close");

			dir.Close();
		}