#r "packages/FAKE/tools/fakelib.dll"

open Fake.Testing.XUnit2
open Fake

let buildDir = "./build/"
let testDir = "./tests/"

Target "Clean" (fun _ ->
    CleanDirs [buildDir; testDir]
)

Target "BuildApp" (fun _ ->
    !! "src/app/**/*.fsproj"
      |> MSBuildRelease buildDir "Build"
      |> Log "AppBuild-Output: "
)

Target "BuildTest" (fun _ ->
    !! "src/tests/**/*.fsproj"
      |> MSBuildDebug testDir "Build"
      |> Log "TestBuild-Output: "
)

Target "RunTests" (fun _ ->
    !! (testDir @@ "/*.Tests.dll")
//      |> xUnit2 (fun p -> {p with HtmlOutputPath = Some (testDir @@ "xunit.html")})
        |> xUnit (fun p -> {p with 
                                OutputDir = testDir
                                ToolPath = "packages/xunit.runners/tools/xunit.console.x86.exe"})
)

Target "Default" (fun _ ->
    trace "Build from fake"
)

"Clean"
  ==> "BuildApp"
  ==> "BuildTest"
  ==> "RunTests"
  ==> "Default"

RunTargetOrDefault "Default"

#r "packages/FAKE/tools/fakelib.dll"

open Fake.Testing.XUnit2
open Fake

let buildDir = "./build/"
let testDir = "./tests/"

Target "Clean" (fun _ ->
    CleanDirs [buildDir; testDir]
)

Target "BuildApp" (fun _ ->
    !! "src/app/**/*.fsproj"
      |> MSBuildRelease buildDir "Build"
      |> Log "AppBuild-Output: "
)

Target "BuildTest" (fun _ ->
    !! "src/tests/**/*.fsproj"
      |> MSBuildDebug testDir "Build"
      |> Log "TestBuild-Output: "
)

Target "RunTests" (fun _ ->
    !! (testDir @@ "/*.Tests.dll")
        |> xUnit (fun p -> {p with 
                                ToolPath = "packages/xunit.runners/tools/xunit.console.clr4.exe"})
)

Target "Default" (fun _ ->
    trace "Build from fake"
)

"Clean"
  ==> "BuildApp"
  ==> "BuildTest"
  ==> "RunTests"
  ==> "Default"

RunTargetOrDefault "Default"

Use the correct test runner.
Use the correct test runner.
