Skip to content

Commit

Permalink
#102 for completeness, make sure query param assertions fail when the…
Browse files Browse the repository at this point in the history
…y should
  • Loading branch information
tmenier committed Nov 21, 2016
1 parent 90198cb commit 615fd5e
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions Test/Flurl.Test.Shared/Http/TestingTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,20 @@ public async Task can_setup_multiple_responses() {
[Test]
public async Task can_assert_query_params() {
await "http://www.api.com?x=111&y=222&z=333".GetAsync();

HttpTest.ShouldHaveCalled("http://www.api.com*").WithQueryParam("x");
HttpTest.ShouldHaveCalled("http://www.api.com*").WithQueryParam("y", 222);
HttpTest.ShouldHaveCalled("*").WithQueryParam("z", "*3");
HttpTest.ShouldHaveCalled("*").WithQueryParams(new { z = 333, y = 222 });

Assert.Throws<HttpCallAssertException>(() =>
HttpTest.ShouldHaveCalled("http://www.api.com*").WithQueryParam("w"));
Assert.Throws<HttpCallAssertException>(() =>
HttpTest.ShouldHaveCalled("http://www.api.com*").WithQueryParam("y", 223));
Assert.Throws<HttpCallAssertException>(() =>
HttpTest.ShouldHaveCalled("*").WithQueryParam("z", "*4"));
Assert.Throws<HttpCallAssertException>(() =>
HttpTest.ShouldHaveCalled("*").WithQueryParams(new { x = 111, y = 666 }));
}

[Test]
Expand Down

0 comments on commit 615fd5e

Please sign in to comment.