Пример #1
0
        public void IncludePortNumber()
        {
            const string sslPort    = "443";
            var          uriBuilder = new LevelUpUriBuilder().SetPath("ThisIsATest");

            uriBuilder.Environment.Should().Be(LevelUpEnvironment.Sandbox);
            uriBuilder.Build().Should().NotContain(sslPort);
            uriBuilder.Build(false).Should().NotContain(sslPort);
            uriBuilder.Build(true).Should().Contain(sslPort);
        }
Пример #2
0
        public string GetOrderQueryRequestEndpoint(OrderQueryRequest request)
        {
            string            path    = $"locations/{request.LocationId}/orders";
            LevelUpUriBuilder builder = new LevelUpUriBuilder(_targetEnviornment);

            builder.SetApiVersion(request.ApiVersion).SetPath(path);

            if (request.PageNumber > 1)
            {
                builder.AppendQuery("page", request.PageNumber.ToString());
            }

            return(builder.Build());
        }
        public string Visit(OrderQueryRequest request)
        {
            string            path    = string.Format("locations/{0}/orders", request.LocationId);
            LevelUpUriBuilder builder = new LevelUpUriBuilder(TargetEnviornment);

            builder.SetApiVersion(request.ApiVersion).SetPath(path);

            if (request.PageNumber > 1)
            {
                builder.AppendQuery("page", request.PageNumber.ToString());
            }

            return(builder.Build());
        }
Пример #4
0
        public void AppendQuery()
        {
            const string query      = "test=yes";
            const string query1     = "level=up";
            var          uriBuilder = new LevelUpUriBuilder().SetPath("ThisIsATest").AppendQuery("test", "yes").AppendQuery("level", "up");

            uriBuilder.Environment.Should().Be(LevelUpEnvironment.Sandbox);
            string uri = uriBuilder.Build();

            uri.Should().Contain("?" + query);
            uri.Should().Contain("&" + query1);

            var    uriBuilder1 = new LevelUpUriBuilder().SetPath("ThisIsATest").AppendQuery("test", "yes").AppendQuery("test", "yes");
            string uri1        = uriBuilder1.Build();

            uri1.Should().Contain("?" + query);
            uri1.Should().NotContain("&" + query);
        }