예제 #1
0
        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);
        }
예제 #2
0
        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);
        }
예제 #3
0
        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);
        }
예제 #4
0
        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());
        }