type TestDir =
{ Dir : string }
interface System.IDisposable with
member x.Dispose() =
try
Directory.Delete(x.Dir, true)
with e ->
eprintf "Failed to delete '%s': %O" x.Dir e
()
let createTestDir () =
let testFile = Path.Combine (Path.GetTempPath (), Path.GetRandomFileName ())
Directory.CreateDirectory(testFile)
|> ignore<DirectoryInfo>
{ Dir = testFile }
[<Tests>]
let tests =
testList "Tests" [
test "test" {
use testDir = createTestDir() // <- FS0001
()
}
]
Workaround use testCase "test" <| fun _ -> instead
Example:
Workaround use
testCase "test" <| fun _ ->
instead