Functional test to show FSharpAsync works end-to-end (#6240)

This commit is contained in:
Steve Sanderson 2017-05-08 19:30:01 +01:00 committed by GitHub
parent 3164046233
commit debc3dd433
2 changed files with 17 additions and 0 deletions

View File

@ -28,5 +28,17 @@ namespace Microsoft.AspNetCore.Mvc.FunctionalTests
Assert.Equal(HttpStatusCode.OK, response.StatusCode);
Assert.Contains("<h1>Hello from FSharpWebSite</h1>", responseBody);
}
[Fact]
public async Task HomeAsyncAction_ReturnsContentAsynchronously()
{
// Act
var response = await Client.GetAsync("http://localhost/home/asyncaction");
var responseBody = await response.Content.ReadAsStringAsync();
// Assert
Assert.Equal(HttpStatusCode.OK, response.StatusCode);
Assert.Contains("Action completed asynchronously", responseBody);
}
}
}

View File

@ -14,3 +14,8 @@ type HomeController () =
member this.Index () =
this.View()
member this.AsyncAction () = async {
do! Async.Sleep 50
return this.Content("Action completed asynchronously")
}