Rename all ReRoute to Route to move closer to YARP +semver: breaking

This commit is contained in:
Tom Pallister
2020-05-23 20:50:05 +01:00
committed by GitHub
parent fe3e8bd23a
commit 3439be8927
269 changed files with 23591 additions and 23605 deletions

View File

@@ -16,7 +16,7 @@ namespace Ocelot.UnitTests.Configuration
public class HeaderFindAndReplaceCreatorTests
{
private HeaderFindAndReplaceCreator _creator;
private FileReRoute _reRoute;
private FileRoute _route;
private HeaderTransformations _result;
private Mock<IPlaceholders> _placeholders;
private Mock<IOcelotLoggerFactory> _factory;
@@ -34,13 +34,13 @@ namespace Ocelot.UnitTests.Configuration
[Fact]
public void should_create()
{
var reRoute = new FileReRoute
var route = new FileRoute
{
UpstreamHeaderTransform = new Dictionary<string, string>
{
{"Test", "Test, Chicken"},
{"Moop", "o, a"}
},
},
DownstreamHeaderTransform = new Dictionary<string, string>
{
{"Pop", "West, East"},
@@ -60,7 +60,7 @@ namespace Ocelot.UnitTests.Configuration
new HeaderFindAndReplace("Bop", "e", "r", 0)
};
this.Given(x => GivenTheReRoute(reRoute))
this.Given(x => GivenTheRoute(route))
.When(x => WhenICreate())
.Then(x => ThenTheFollowingUpstreamIsReturned(upstream))
.Then(x => ThenTheFollowingDownstreamIsReturned(downstream))
@@ -71,19 +71,19 @@ namespace Ocelot.UnitTests.Configuration
public void should_create_with_add_headers_to_request()
{
const string key = "X-Forwarded-For";
const string value = "{RemoteIpAddress}";
const string value = "{RemoteIpAddress}";
var reRoute = new FileReRoute
var route = new FileRoute
{
UpstreamHeaderTransform = new Dictionary<string, string>
{
{key, value},
}
};
};
var expected = new AddHeader(key, value);
this.Given(x => GivenTheReRoute(reRoute))
this.Given(x => GivenTheRoute(route))
.When(x => WhenICreate())
.Then(x => ThenTheFollowingAddHeaderToUpstreamIsReturned(expected))
.BDDfy();
@@ -92,8 +92,8 @@ namespace Ocelot.UnitTests.Configuration
[Fact]
public void should_use_base_url_placeholder()
{
var reRoute = new FileReRoute
{
var route = new FileRoute
{
DownstreamHeaderTransform = new Dictionary<string, string>
{
{"Location", "http://www.bbc.co.uk/, {BaseUrl}"},
@@ -105,7 +105,7 @@ namespace Ocelot.UnitTests.Configuration
new HeaderFindAndReplace("Location", "http://www.bbc.co.uk/", "http://ocelot.com/", 0),
};
this.Given(x => GivenTheReRoute(reRoute))
this.Given(x => GivenTheRoute(route))
.And(x => GivenTheBaseUrlIs("http://ocelot.com/"))
.When(x => WhenICreate())
.Then(x => ThenTheFollowingDownstreamIsReturned(downstream))
@@ -115,7 +115,7 @@ namespace Ocelot.UnitTests.Configuration
[Fact]
public void should_log_errors_and_not_add_headers()
{
var reRoute = new FileReRoute
var route = new FileRoute
{
DownstreamHeaderTransform = new Dictionary<string, string>
{
@@ -131,7 +131,7 @@ namespace Ocelot.UnitTests.Configuration
{
};
this.Given(x => GivenTheReRoute(reRoute))
this.Given(x => GivenTheRoute(route))
.And(x => GivenTheBaseUrlErrors())
.When(x => WhenICreate())
.Then(x => ThenTheFollowingDownstreamIsReturned(expected))
@@ -149,8 +149,8 @@ namespace Ocelot.UnitTests.Configuration
[Fact]
public void should_use_base_url_partial_placeholder()
{
var reRoute = new FileReRoute
{
var route = new FileRoute
{
DownstreamHeaderTransform = new Dictionary<string, string>
{
{"Location", "http://www.bbc.co.uk/pay, {BaseUrl}pay"},
@@ -162,7 +162,7 @@ namespace Ocelot.UnitTests.Configuration
new HeaderFindAndReplace("Location", "http://www.bbc.co.uk/pay", "http://ocelot.com/pay", 0),
};
this.Given(x => GivenTheReRoute(reRoute))
this.Given(x => GivenTheRoute(route))
.And(x => GivenTheBaseUrlIs("http://ocelot.com/"))
.When(x => WhenICreate())
.Then(x => ThenTheFollowingDownstreamIsReturned(downstream))
@@ -172,8 +172,8 @@ namespace Ocelot.UnitTests.Configuration
[Fact]
public void should_add_trace_id_header()
{
var reRoute = new FileReRoute
{
var route = new FileRoute
{
DownstreamHeaderTransform = new Dictionary<string, string>
{
{"Trace-Id", "{TraceId}"},
@@ -182,7 +182,7 @@ namespace Ocelot.UnitTests.Configuration
var expected = new AddHeader("Trace-Id", "{TraceId}");
this.Given(x => GivenTheReRoute(reRoute))
this.Given(x => GivenTheRoute(route))
.And(x => GivenTheBaseUrlIs("http://ocelot.com/"))
.When(x => WhenICreate())
.Then(x => ThenTheFollowingAddHeaderToDownstreamIsReturned(expected))
@@ -192,7 +192,7 @@ namespace Ocelot.UnitTests.Configuration
[Fact]
public void should_add_downstream_header_as_is_when_no_replacement_is_given()
{
var reRoute = new FileReRoute
var route = new FileRoute
{
DownstreamHeaderTransform = new Dictionary<string, string>
{
@@ -202,7 +202,7 @@ namespace Ocelot.UnitTests.Configuration
var expected = new AddHeader("X-Custom-Header", "Value");
this.Given(x => GivenTheReRoute(reRoute))
this.Given(x => GivenTheRoute(route))
.And(x => WhenICreate())
.Then(x => x.ThenTheFollowingAddHeaderToDownstreamIsReturned(expected))
.BDDfy();
@@ -211,7 +211,7 @@ namespace Ocelot.UnitTests.Configuration
[Fact]
public void should_add_upstream_header_as_is_when_no_replacement_is_given()
{
var reRoute = new FileReRoute
var route = new FileRoute
{
UpstreamHeaderTransform = new Dictionary<string, string>
{
@@ -221,7 +221,7 @@ namespace Ocelot.UnitTests.Configuration
var expected = new AddHeader("X-Custom-Header", "Value");
this.Given(x => GivenTheReRoute(reRoute))
this.Given(x => GivenTheRoute(route))
.And(x => WhenICreate())
.Then(x => x.ThenTheFollowingAddHeaderToUpstreamIsReturned(expected))
.BDDfy();
@@ -241,8 +241,8 @@ namespace Ocelot.UnitTests.Configuration
{
_result.AddHeadersToDownstream[0].Key.ShouldBe(addHeader.Key);
_result.AddHeadersToDownstream[0].Value.ShouldBe(addHeader.Value);
}
}
private void ThenTheFollowingAddHeaderToUpstreamIsReturned(AddHeader addHeader)
{
_result.AddHeadersToUpstream[0].Key.ShouldBe(addHeader.Key);
@@ -251,8 +251,8 @@ namespace Ocelot.UnitTests.Configuration
private void ThenTheFollowingDownstreamIsReturned(List<HeaderFindAndReplace> downstream)
{
_result.Downstream.Count.ShouldBe(downstream.Count);
_result.Downstream.Count.ShouldBe(downstream.Count);
for (int i = 0; i < _result.Downstream.Count; i++)
{
var result = _result.Downstream[i];
@@ -261,23 +261,23 @@ namespace Ocelot.UnitTests.Configuration
result.Index.ShouldBe(expected.Index);
result.Key.ShouldBe(expected.Key);
result.Replace.ShouldBe(expected.Replace);
}
}
}
private void GivenTheReRoute(FileReRoute reRoute)
private void GivenTheRoute(FileRoute route)
{
_reRoute = reRoute;
_route = route;
}
private void WhenICreate()
{
_result = _creator.Create(_reRoute);
_result = _creator.Create(_route);
}
private void ThenTheFollowingUpstreamIsReturned(List<HeaderFindAndReplace> expecteds)
{
_result.Upstream.Count.ShouldBe(expecteds.Count);
_result.Upstream.Count.ShouldBe(expecteds.Count);
for (int i = 0; i < _result.Upstream.Count; i++)
{
var result = _result.Upstream[i];
@@ -289,4 +289,4 @@ namespace Ocelot.UnitTests.Configuration
}
}
}
}
}