Skip to content

Commit

Permalink
Test for #366 & #398
Browse files Browse the repository at this point in the history
  • Loading branch information
tmenier committed Feb 15, 2019
1 parent 6ad5659 commit 7c5d197
Showing 1 changed file with 15 additions and 12 deletions.
27 changes: 15 additions & 12 deletions Test/Flurl.Test/Http/TestingTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -284,8 +284,11 @@ public async Task doesnt_record_calls_made_with_HttpClient() {
}
}

[Test] // #366 (cannot repro)
[Test, Ignore("bug repro, not yet fixed")] // #366 & #398
public async Task can_use_response_queue_in_parallel() {
var cli = new FlurlClient("http://api.com");
cli.Settings.BeforeCallAsync = call => Task.Delay(500);

for (var i = 0; i < 100; i++) {
using (var test = new HttpTest()) {
test
Expand All @@ -301,19 +304,19 @@ public async Task can_use_response_queue_in_parallel() {
.RespondWith("9");

var results = await Task.WhenAll(
"http://api.com".GetStringAsync(),
"http://api.com".GetStringAsync(),
"http://api.com".GetStringAsync(),
"http://api.com".GetStringAsync(),
"http://api.com".GetStringAsync(),
"http://api.com".GetStringAsync(),
"http://api.com".GetStringAsync(),
"http://api.com".GetStringAsync(),
"http://api.com".GetStringAsync(),
"http://api.com".GetStringAsync());
cli.Request().GetStringAsync(),
cli.Request().GetStringAsync(),
cli.Request().GetStringAsync(),
cli.Request().GetStringAsync(),
cli.Request().GetStringAsync(),
cli.Request().GetStringAsync(),
cli.Request().GetStringAsync(),
cli.Request().GetStringAsync(),
cli.Request().GetStringAsync(),
cli.Request().GetStringAsync());

CollectionAssert.IsEmpty(test.ResponseQueue);
CollectionAssert.AllItemsAreUnique(results);
CollectionAssert.IsEmpty(test.ResponseQueue);
}
}
}
Expand Down

0 comments on commit 7c5d197

Please sign in to comment.