Skip to content

Commit

Permalink
Test for #366
Browse files Browse the repository at this point in the history
cannot repro
  • Loading branch information
tmenier committed Jan 25, 2019
1 parent 74588eb commit 71993a7
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions Test/Flurl.Test/Http/TestingTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,40 @@ public async Task doesnt_record_calls_made_with_HttpClient() {
CollectionAssert.IsEmpty(httpTest.CallLog);
}
}

[Test] // #366 (cannot repro)
public async Task can_use_response_queue_in_parallel() {
for (var i = 0; i < 100; i++) {
using (var test = new HttpTest()) {
test
.RespondWith("0")
.RespondWith("1")
.RespondWith("2")
.RespondWith("3")
.RespondWith("4")
.RespondWith("5")
.RespondWith("6")
.RespondWith("7")
.RespondWith("8")
.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());

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

[TestFixture]
Expand Down

0 comments on commit 71993a7

Please sign in to comment.