From 615fd5eb93db7427a90a3806219394b826698bf4 Mon Sep 17 00:00:00 2001 From: Todd Menier Date: Sun, 20 Nov 2016 18:51:01 -0600 Subject: [PATCH] #102 for completeness, make sure query param assertions fail when they should --- Test/Flurl.Test.Shared/Http/TestingTests.cs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Test/Flurl.Test.Shared/Http/TestingTests.cs b/Test/Flurl.Test.Shared/Http/TestingTests.cs index 568a16d1..460330ff 100644 --- a/Test/Flurl.Test.Shared/Http/TestingTests.cs +++ b/Test/Flurl.Test.Shared/Http/TestingTests.cs @@ -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(() => + HttpTest.ShouldHaveCalled("http://www.api.com*").WithQueryParam("w")); + Assert.Throws(() => + HttpTest.ShouldHaveCalled("http://www.api.com*").WithQueryParam("y", 223)); + Assert.Throws(() => + HttpTest.ShouldHaveCalled("*").WithQueryParam("z", "*4")); + Assert.Throws(() => + HttpTest.ShouldHaveCalled("*").WithQueryParams(new { x = 111, y = 666 })); } [Test]