diff --git a/test/Ocelot.Benchmarks/DownstreamRouteFinderMiddlewareBenchmarks.cs b/test/Ocelot.Benchmarks/DownstreamRouteFinderMiddlewareBenchmarks.cs index b3b72f9b..484e91d3 100644 --- a/test/Ocelot.Benchmarks/DownstreamRouteFinderMiddlewareBenchmarks.cs +++ b/test/Ocelot.Benchmarks/DownstreamRouteFinderMiddlewareBenchmarks.cs @@ -27,6 +27,7 @@ using BenchmarkDotNet.Validators; using Ocelot.DownstreamRouteFinder.Middleware; using Ocelot.DownstreamRouteFinder.Finder; using Ocelot.Middleware.Multiplexer; +using Ocelot.Configuration; namespace Ocelot.Benchmarks { @@ -54,7 +55,6 @@ namespace Ocelot.Benchmarks var services = serviceCollection.BuildServiceProvider(); var loggerFactory = services.GetService(); var drpf = services.GetService(); - var icr = services.GetService(); var multiplexer = services.GetService(); _next = async context => { @@ -62,8 +62,16 @@ namespace Ocelot.Benchmarks throw new Exception("BOOM"); }; - _middleware = new DownstreamRouteFinderMiddleware(_next, loggerFactory, drpf, icr, multiplexer); - _downstreamContext = new DownstreamContext(new DefaultHttpContext()); + _middleware = new DownstreamRouteFinderMiddleware(_next, loggerFactory, drpf, multiplexer); + var httpContext = new DefaultHttpContext(); + httpContext.Request.Path = new PathString("/test"); + httpContext.Request.QueryString = new QueryString("?a=b"); + httpContext.Request.Headers.Add("Host", "most"); + + _downstreamContext = new DownstreamContext(httpContext) + { + Configuration = new InternalConfiguration(new List(), null, null, null, null, null, null, null) + }; } [Benchmark(Baseline = true)] diff --git a/test/Ocelot.Benchmarks/Program.cs b/test/Ocelot.Benchmarks/Program.cs index d830a46b..d642032d 100644 --- a/test/Ocelot.Benchmarks/Program.cs +++ b/test/Ocelot.Benchmarks/Program.cs @@ -1,19 +1,20 @@ -using BenchmarkDotNet.Running; - -namespace Ocelot.Benchmarks -{ - public class Program - { - public static void Main(string[] args) - { - var switcher = new BenchmarkSwitcher(new[] { - typeof(DictionaryBenchmarks), - typeof(UrlPathToUrlPathTemplateMatcherBenchmarks), - typeof(AllTheThingsBenchmarks), - typeof(ExceptionHandlerMiddlewareBenchmarks) - }); - - switcher.Run(args); - } - } -} +using BenchmarkDotNet.Running; + +namespace Ocelot.Benchmarks +{ + public class Program + { + public static void Main(string[] args) + { + var switcher = new BenchmarkSwitcher(new[] { + typeof(DictionaryBenchmarks), + typeof(UrlPathToUrlPathTemplateMatcherBenchmarks), + typeof(AllTheThingsBenchmarks), + typeof(ExceptionHandlerMiddlewareBenchmarks), + typeof(DownstreamRouteFinderMiddlewareBenchmarks) + }); + + switcher.Run(args); + } + } +}