public void GetParametersString_AnonymousData_CorrectString(List<KeyValuePair<string, string>> parameters, HttpUtils sut) { var expectedValue = string.Concat(parameters.OrderBy(a => a.Key).Select(a => $"{a.Key}={a.Value}")); var result = sut.GetParametersString(parameters); result.Should().Be(expectedValue); }
public void GetParametersString_AnonymousDataWithDevimeter_CorrectString( string firstParameter, string secondParameter, HttpUtils sut) { var parameters = new[] { new KeyValuePair<string, string>("a", firstParameter), new KeyValuePair<string, string>("a", secondParameter), }; var expectedValue = $"{parameters[0].Key}={parameters[0].Value}&{parameters[1].Key}={parameters[1].Value}"; var result = sut.GetParametersString(parameters, "&"); result.Should().Be(expectedValue); }
public void ParseParameterString_ValidUrlParameterString_CorrectResult(List<KeyValuePair<string, string>> parameters, HttpUtils sut) { var parameterString = "?" + sut.GetParametersString(parameters, "&"); var result = sut.ParseParameterString(parameterString); result.ShouldAllBeEquivalentTo(parameters); }