mirror of
				https://github.com/nsnail/Ocelot.git
				synced 2025-11-04 20:10:50 +08:00 
			
		
		
		
	tests for downstream http version validation
This commit is contained in:
		@@ -305,6 +305,71 @@
 | 
				
			|||||||
                .BDDfy();
 | 
					                .BDDfy();
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        [Theory]
 | 
				
			||||||
 | 
					        [InlineData("1.0")]
 | 
				
			||||||
 | 
					        [InlineData("1.1")]
 | 
				
			||||||
 | 
					        [InlineData("2.0")]
 | 
				
			||||||
 | 
					        [InlineData("1,0")]
 | 
				
			||||||
 | 
					        [InlineData("1,1")]
 | 
				
			||||||
 | 
					        [InlineData("2,0")]
 | 
				
			||||||
 | 
					        [InlineData("1")]
 | 
				
			||||||
 | 
					        [InlineData("2")]
 | 
				
			||||||
 | 
					        [InlineData("")]
 | 
				
			||||||
 | 
					        [InlineData(null)]
 | 
				
			||||||
 | 
					        public void should_be_valid_re_route_using_downstream_http_version(string version)
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            var fileReRoute = new FileReRoute
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                DownstreamPathTemplate = "/test",
 | 
				
			||||||
 | 
					                UpstreamPathTemplate = "/test",
 | 
				
			||||||
 | 
					                DownstreamHostAndPorts = new List<FileHostAndPort>
 | 
				
			||||||
 | 
					                {
 | 
				
			||||||
 | 
					                    new FileHostAndPort
 | 
				
			||||||
 | 
					                    {
 | 
				
			||||||
 | 
					                        Host = "localhost",
 | 
				
			||||||
 | 
					                        Port = 5000,
 | 
				
			||||||
 | 
					                    },
 | 
				
			||||||
 | 
					                },
 | 
				
			||||||
 | 
					                DownstreamHttpVersion = version,
 | 
				
			||||||
 | 
					            };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            this.Given(_ => GivenThe(fileReRoute))
 | 
				
			||||||
 | 
					                .When(_ => WhenIValidate())
 | 
				
			||||||
 | 
					                .Then(_ => ThenTheResultIsValid())
 | 
				
			||||||
 | 
					                .BDDfy();
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        [Theory]
 | 
				
			||||||
 | 
					        [InlineData("retg1.1")]
 | 
				
			||||||
 | 
					        [InlineData("re2.0")]
 | 
				
			||||||
 | 
					        [InlineData("1,0a")]
 | 
				
			||||||
 | 
					        [InlineData("a1,1")]
 | 
				
			||||||
 | 
					        [InlineData("12,0")]
 | 
				
			||||||
 | 
					        [InlineData("asdf")]
 | 
				
			||||||
 | 
					        public void should_be_invalid_re_route_using_downstream_http_version(string version)
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            var fileReRoute = new FileReRoute
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                DownstreamPathTemplate = "/test",
 | 
				
			||||||
 | 
					                UpstreamPathTemplate = "/test",
 | 
				
			||||||
 | 
					                DownstreamHostAndPorts = new List<FileHostAndPort>
 | 
				
			||||||
 | 
					                {
 | 
				
			||||||
 | 
					                    new FileHostAndPort
 | 
				
			||||||
 | 
					                    {
 | 
				
			||||||
 | 
					                        Host = "localhost",
 | 
				
			||||||
 | 
					                        Port = 5000,
 | 
				
			||||||
 | 
					                    },
 | 
				
			||||||
 | 
					                },
 | 
				
			||||||
 | 
					                DownstreamHttpVersion = version,
 | 
				
			||||||
 | 
					            };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            this.Given(_ => GivenThe(fileReRoute))
 | 
				
			||||||
 | 
					                .When(_ => WhenIValidate())
 | 
				
			||||||
 | 
					                .Then(_ => ThenTheResultIsInvalid())
 | 
				
			||||||
 | 
					                .And(_ => ThenTheErrorsContains("'Downstream Http Version' is not in the correct format."))
 | 
				
			||||||
 | 
					                .BDDfy();
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        private void GivenAnAuthProvider(string key)
 | 
					        private void GivenAnAuthProvider(string key)
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            var schemes = new List<AuthenticationScheme>
 | 
					            var schemes = new List<AuthenticationScheme>
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user