anchor.diff: -﻿module ScriptTests
  +﻿namespace FlexSearch.Tests
   
  +open FlexSearch.Tests
   open FlexSearch.Api.Model
   open FlexSearch.Core
   open Swensen.Unquote
  
positive.code: open System.IO
  open System.Linq
  
  type ``Script - Compilation test``() = 
      member __.``Script should compile``() = 
          let scriptSrc = """
  #if INTERACTIVE
  
negative.code:         let doc = new Document()
          result.PreIndexScript.Value.Invoke(doc)
          test <@ doc.Fields.["test"] = "test1" @>
      
      member __.``End to end preIndex script test`` (ih : IntegrationHelper) = 
          let scriptSrc = """
  module Script
  
  open FlexSearch.Api.Model
  open Helpers
  
  let preIndex(document : Document) = 
      document.Set("i1", "100")"""
          ih |> addIndexPass
          let writer = extract <| ih.IndexService.IsIndexOnline(ih.IndexName)
          ih |> closeIndexPass
          // Dump the script to the configuration folder
          File.WriteAllText(writer.Settings.SettingsFolder +/ "script.fsx", scriptSrc)
          ih |> openIndexPass
          ih |> addDocByIdPass "1"
          ih |> refreshIndexPass
          // The above doc should have i1 = 100
          test <@ (extract <| ih.DocumentService.GetDocument(ih.IndexName, "1")).Fields.["i1"] = "100" @>
  