public void AppendQueryParams_AddsQueryWithoutQMark_IfQMarkAtTheEnd() { //arrange. var url = "url?"; var queryParams = new ListQueryParams { EndKey = "end-key" }; //act. var newUrl = QueryParams.AppendQueryParams(url, queryParams); //assert. Assert.Equal($"{url}{queryParams.ToQueryString()}", newUrl); }
public void AppendQueryParams_AppendsQueryWithQMark_IfNoneYet() { //arrange. var url = "url"; var queryParams = new ListQueryParams { EndKey = "end-key" }; //act. var newUrl = QueryParams.AppendQueryParams(url, queryParams); //assert. Assert.Equal($"{url}?{queryParams.ToQueryString()}", newUrl); }
public void AppendQueryParam_AppendsQueryWithoutQMark_IfQMarkPresent() { //arrange. var url = "url?param1=value1"; var queryParams = new ListQueryParams { EndKey = "end-key" }; //act. var newUrl = QueryParams.AppendQueryParams(url, queryParams); //assert. Assert.Equal($"{url}&{queryParams.ToQueryString()}", newUrl); }
public void FromListParams_GivesSameQueryString() { //arrange. var listParams = new ListQueryParams { Conflicts = false, StartKey = "start-key" }; //act. QueryParams sut = listParams; //assert. Assert.NotNull(sut); Assert.Equal(listParams.ToQueryString(), sut.ToQueryString()); }