Skip to content

Commit

Permalink
Delete temp files
Browse files Browse the repository at this point in the history
  • Loading branch information
mausch committed Feb 9, 2013
1 parent db26117 commit 42d94cf
Showing 1 changed file with 15 additions and 8 deletions.
23 changes: 15 additions & 8 deletions tests/FSharpx.Tests/ControlTests.fs
Expand Up @@ -570,12 +570,15 @@ type public WebClientTests() =
let wc = new WebClient()
return! wc.AsyncUploadFile(new Uri(uri), fileName) }

File.WriteAllText("tmp.bin", "FSharpx test AsyncUploadFile")

let bytes = upload "http://httpbin.org/post" "tmp.bin" |> Async.RunSynchronously
let filename = "tmp.bin"
try
File.WriteAllText(filename, "FSharpx test AsyncUploadFile")
let bytes = upload "http://httpbin.org/post" filename |> Async.RunSynchronously

let response = Encoding.ASCII.GetString(bytes)
Assert.IsTrue(response.Contains("FSharpx test AsyncUploadFile"))
let response = Encoding.ASCII.GetString(bytes)
Assert.IsTrue(response.Contains("FSharpx test AsyncUploadFile"))
finally
File.Delete filename

[<Test>]
member this.AsyncUploadData() =
Expand Down Expand Up @@ -622,10 +625,14 @@ type public WebClientTests() =
let wc = new WebClient()
return! wc.AsyncDownloadFile(new Uri(uri), localFile) }

download "http://www.gnu.org/licenses/gpl-2.0.txt" "gpl.txt" |> Async.RunSynchronously
let filename = "gpl.txt"
try
download "http://www.gnu.org/licenses/gpl-2.0.txt" filename |> Async.RunSynchronously
let text = File.ReadAllText filename
Assert.IsTrue(text.Contains("GNU GENERAL PUBLIC LICENSE"))
finally
File.Delete filename

let text = File.ReadAllText("gpl.txt")
Assert.IsTrue(text.Contains("GNU GENERAL PUBLIC LICENSE"))

[<Test>]
member this.AsyncDownloadData() =
Expand Down

0 comments on commit 42d94cf

Please sign in to comment.