diff --git a/test/Ocelot.UnitTests/Configuration/Validation/ReRouteFluentValidatorTests.cs b/test/Ocelot.UnitTests/Configuration/Validation/ReRouteFluentValidatorTests.cs index 9433bb89..82b3e646 100644 --- a/test/Ocelot.UnitTests/Configuration/Validation/ReRouteFluentValidatorTests.cs +++ b/test/Ocelot.UnitTests/Configuration/Validation/ReRouteFluentValidatorTests.cs @@ -305,6 +305,71 @@ .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 + { + 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 + { + 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) { var schemes = new List