Functional test to show FSharpAsync works end-to-end (#6240)
This commit is contained in:
parent
3164046233
commit
debc3dd433
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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")
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue