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

TestLockObtainFailed() private method

private TestLockObtainFailed ( ) : void
return void
		public virtual void  TestLockObtainFailed()
		{
			Directory dir = new RAMDirectory();
			
			IndexWriter writer = null;
			IndexReader reader = null;
			Term searchTerm = new Term("content", "aaa");
			
			//  add 11 documents with term : aaa
			writer = new IndexWriter(dir, new WhitespaceAnalyzer(), true, IndexWriter.MaxFieldLength.LIMITED);
			for (int i = 0; i < 11; i++)
			{
				AddDoc(writer, searchTerm.Text);
			}
			
			// Create reader:
			reader = IndexReader.Open(dir, false);
			
			// Try to make changes
            Assert.Throws<LockObtainFailedException>(() => reader.DeleteDocument(4), "deleteDocument should have hit LockObtainFailedException");
            Assert.Throws<LockObtainFailedException>(() =>reader.SetNorm(5, "aaa", 2.0f), "setNorm should have hit LockObtainFailedException");
            Assert.Throws<LockObtainFailedException>(() => reader.UndeleteAll(), "undeleteAll should have hit LockObtainFailedException");

			writer.Close();
			reader.Close();
		}