Fix QueryStringParser (#389)

* Fix QueryStringParser

* add extra test
This commit is contained in:
Stef Heyenrath
2019-12-09 17:20:17 +01:00
committed by GitHub
parent 178f2cf02f
commit 45d8c0cc27
3 changed files with 33 additions and 4 deletions

View File

@@ -188,6 +188,34 @@ namespace WireMock.Net.Tests.Util
result["key"].Should().Equal(new WireMockList<string>(new[] { "1", "2", "3" }));
}
[Fact]
public void Parse_With1ParamContainingEscapedAnd()
{
// Assign
string query = "?winkel=C%26A";
// Act
var result = QueryStringParser.Parse(query);
// Assert
result.Count.Should().Be(1);
result["winkel"].Should().Equal(new WireMockList<string>(new[] { "C&A" }));
}
[Fact]
public void Parse_With1ParamContainingParentheses()
{
// Assign
string query = "?Transaction=(123)";
// Act
var result = QueryStringParser.Parse(query);
// Assert
result.Count.Should().Be(1);
result["Transaction"].Should().Equal(new WireMockList<string>(new[] { "(123)" }));
}
[Fact]
public void Parse_WithMultipleParamWithSameKey()
{
@@ -227,12 +255,12 @@ namespace WireMock.Net.Tests.Util
// Assert
result.Count.Should().Be(6);
result["q"].Should().Equal(new WireMockList<string>("energy+edge"));
result["q"].Should().Equal(new WireMockList<string>("energy edge"));
result["rls"].Should().Equal(new WireMockList<string>("com.microsoft:en-au"));
result["ie"].Should().Equal(new WireMockList<string>("UTF-8"));
result["oe"].Should().Equal(new WireMockList<string>("UTF-8"));
result["startIndex"].Should().Equal(new WireMockList<string>());
result["startPage"].Should().Equal(new WireMockList<string>("1%22"));
result["startPage"].Should().Equal(new WireMockList<string>("1\""));
}
}
}