anchor.diff:      ireader.Close()
       directory.close()
   
  +let GetRandomPath() = 
  +    let dir = Path.Combine(AppDomain.CurrentDomain.SetupInformation.ApplicationBase, Guid.NewGuid().ToString())
  +    (new java.io.File(dir)).toPath()
  +
   [<Fact>]
   let CodecsShouldLoadProperly() = 
  -    ShouldHaveFlexCodec410()
  -    ShouldHaveFlexCodec50()
  +    ShouldHaveFlexCodec410 |> exceptionWrapper
  +    ShouldHaveFlexCodec50 |> exceptionWrapper
   
   [<Fact>]
   let PostingsFormatShouldLoadProperly() = ShouldHaveFlexPerFieldPostingsFormat()
   
   [<Fact>]
  -let SimpleIndexingTest() = 
  -    let analyzer = new StandardAnalyzer()
  -    let directory = new RAMDirectory()
  -    let config = new IndexWriterConfig(analyzer)
  -    let iwriter = new IndexWriter(directory, config)
  -    let doc = new Document()
  -    let text = "This is the text to be indexed."
  -    doc.Add(new Field("fieldname", text, TextField.TYPE_STORED))
  -    iwriter.AddDocument(doc)
  -    iwriter.Close()
  -    // Now search the index:
  -    let ireader = DirectoryReader.Open(directory)
  -    let isearcher = new IndexSearcher(ireader)
  -    // Parse a simple query that searches for "text":
  -    let parser = new QueryParser("fieldname", analyzer)
  -    let query = parser.Parse("text")
  -    let topDocs = isearcher.Search(query, null, 1000)
  -    let hits : ScoreDoc [] = topDocs.ScoreDocs
  -    Assert.Equal<int>(1, hits.Length)
  -    // Iterate through the results:
  -    for i = 0 to hits.Length - 1 do
  -        let hitDoc = isearcher.Doc(hits.[i].Doc)
  -        Assert.Equal<string>("This is the text to be indexed.", hitDoc.Get("fieldname"))
  -    ireader.Close()
  -    directory.Close()
  -
  -[<Fact>]
  -let SimplePhysicalIndexingTest() = 
  -    IndexingTest(new RAMDirectory())
  -    let dir = Path.Combine(AppDomain.CurrentDomain.SetupInformation.ApplicationBase, Guid.NewGuid().ToString())
  -    let file = new java.io.File(dir) 
  -    IndexingTest(new SimpleFSDirectory(file.toPath(), NativeFSLockFactory.INSTANCE))
  -
  -[<Fact>]
  -let SimpleFlexPhysicalIndexingTest() = 
  -    IndexingTest(new RAMDirectory())
  -    let directoryPath = Path.Combine(AppDomain.CurrentDomain.SetupInformation.ApplicationBase, Guid.NewGuid().ToString("N"))
  -    let file = new java.io.File(directoryPath)
  -    IndexingTest(FlexFSDirectory.Open(file.toPath()))
  +let IndexingTests() = 
  +    (fun _ -> IndexingTest(new RAMDirectory())) |> exceptionWrapper
  +    (fun _ -> IndexingTest(new SimpleFSDirectory(GetRandomPath(), NativeFSLockFactory.INSTANCE))) |> exceptionWrapper
  +    (fun _ -> IndexingTest(new MMapDirectory(GetRandomPath(), NativeFSLockFactory.GetDefault()))) |> exceptionWrapper
  +    (fun _ -> IndexingTest(FSDirectory.Open(GetRandomPath()))) |> exceptionWrapper
   
   [<Fact>]
   let BooleanQueryCreationTests() = 
  
positive.code:     let strategy = new RecursivePrefixTreeStrategy(grid, "myGeoField")
      let doc = new Document()
      doc.Add(new IntField("id", 1, Field.Store.YES))
      let pt = ctx.MakePoint (10.0, 10.0)
      doc.Add(new StoredField(strategy.GetFieldName(), pt.getX().ToString() + " " + pt.getY().ToString()))
  
  
  [<EntryPoint>]
  let main argv = 
      [| CodecsShouldLoadProperly; SimpleIndexingTest; BooleanQueryCreationTests; SimplePhysicalIndexingTest; 
         SimpleFlexPhysicalIndexingTest; RangeQueryCreationTests; SimpleSpatialTests |] 
      |> Array.iter (fun meth -> exceptionWrapper meth)
      printfn "Done"
      if hasErrors then 1
  
negative.code: let IndexingTest(directory : FlexLucene.Store.Directory) = 
      let analyzer = new StandardAnalyzer()
      let config = new IndexWriterConfig(analyzer)
      let iwriter = new IndexWriter(directory, config)
      let doc = new Document()
      let text = "This is the text to be indexed."
  