diff --git a/src/Ocelot/Authorisation/ClaimsAuthoriser.cs b/src/Ocelot/Authorisation/ClaimsAuthoriser.cs index 4db1045c..3ca7809e 100644 --- a/src/Ocelot/Authorisation/ClaimsAuthoriser.cs +++ b/src/Ocelot/Authorisation/ClaimsAuthoriser.cs @@ -47,7 +47,8 @@ namespace Ocelot.Authorisation }); } } + return new OkResponse(true); } } -} \ No newline at end of file +} diff --git a/src/Ocelot/Cache/RegionCreator.cs b/src/Ocelot/Cache/RegionCreator.cs index e2ca874b..f5a94c21 100644 --- a/src/Ocelot/Cache/RegionCreator.cs +++ b/src/Ocelot/Cache/RegionCreator.cs @@ -4,7 +4,6 @@ using Ocelot.Configuration.File; namespace Ocelot.Cache { - public class RegionCreator : IRegionCreator { public string Create(FileReRoute reRoute) @@ -21,4 +20,4 @@ namespace Ocelot.Cache return region; } } -} \ No newline at end of file +} diff --git a/src/Ocelot/Cache/Regions.cs b/src/Ocelot/Cache/Regions.cs index f94cc306..baec6087 100644 --- a/src/Ocelot/Cache/Regions.cs +++ b/src/Ocelot/Cache/Regions.cs @@ -8,6 +8,7 @@ namespace Ocelot.Cache { Value = value; } + public List Value {get;private set;} } -} \ No newline at end of file +} diff --git a/src/Ocelot/Claims/Middleware/ClaimsBuilderMiddleware.cs b/src/Ocelot/Claims/Middleware/ClaimsBuilderMiddleware.cs index 5161b247..48f57834 100644 --- a/src/Ocelot/Claims/Middleware/ClaimsBuilderMiddleware.cs +++ b/src/Ocelot/Claims/Middleware/ClaimsBuilderMiddleware.cs @@ -39,6 +39,7 @@ namespace Ocelot.Claims.Middleware return; } } + await _next.Invoke(context); } } diff --git a/src/Ocelot/Configuration/DownstreamHostAndPort.cs b/src/Ocelot/Configuration/DownstreamHostAndPort.cs index 483e7523..186cce2f 100644 --- a/src/Ocelot/Configuration/DownstreamHostAndPort.cs +++ b/src/Ocelot/Configuration/DownstreamHostAndPort.cs @@ -7,6 +7,7 @@ Host = host; Port = port; } + public string Host { get; private set; } public int Port { get; private set; } } diff --git a/src/Ocelot/Configuration/File/FileRateLimitOptions.cs b/src/Ocelot/Configuration/File/FileRateLimitOptions.cs index b9277a3c..c7f99cb0 100644 --- a/src/Ocelot/Configuration/File/FileRateLimitOptions.cs +++ b/src/Ocelot/Configuration/File/FileRateLimitOptions.cs @@ -34,6 +34,4 @@ namespace Ocelot.Configuration.File /// public int HttpStatusCode { get; set; } = 429; } - - } diff --git a/src/Ocelot/Configuration/File/FileRateLimitRule.cs b/src/Ocelot/Configuration/File/FileRateLimitRule.cs index 55346d2e..2dda3084 100644 --- a/src/Ocelot/Configuration/File/FileRateLimitRule.cs +++ b/src/Ocelot/Configuration/File/FileRateLimitRule.cs @@ -6,7 +6,6 @@ using System.Threading.Tasks; namespace Ocelot.Configuration.File { - public class FileRateLimitRule { public FileRateLimitRule() @@ -38,6 +37,7 @@ namespace Ocelot.Configuration.File { return string.Empty; } + var sb = new StringBuilder(); sb.Append( $"{nameof(Period)}:{Period},{nameof(PeriodTimespan)}:{PeriodTimespan:F},{nameof(Limit)}:{Limit},{nameof(ClientWhitelist)}:["); diff --git a/src/Ocelot/Configuration/QoSOptions.cs b/src/Ocelot/Configuration/QoSOptions.cs index c518cfec..60e7cc03 100644 --- a/src/Ocelot/Configuration/QoSOptions.cs +++ b/src/Ocelot/Configuration/QoSOptions.cs @@ -24,6 +24,5 @@ namespace Ocelot.Configuration public int TimeoutValue { get; private set; } public TimeoutStrategy TimeoutStrategy { get; private set; } - } } diff --git a/src/Ocelot/Configuration/ReRouteOptions.cs b/src/Ocelot/Configuration/ReRouteOptions.cs index 5ec316c3..e3a7a7b1 100644 --- a/src/Ocelot/Configuration/ReRouteOptions.cs +++ b/src/Ocelot/Configuration/ReRouteOptions.cs @@ -9,12 +9,12 @@ namespace Ocelot.Configuration IsCached = isCached; IsQos = isQos; EnableRateLimiting = isEnableRateLimiting; - } + public bool IsAuthenticated { get; private set; } public bool IsAuthorised { get; private set; } public bool IsCached { get; private set; } public bool IsQos { get; private set; } public bool EnableRateLimiting { get; private set; } } -} \ No newline at end of file +} diff --git a/src/Ocelot/Configuration/Repository/ConsulFileConfigurationPoller.cs b/src/Ocelot/Configuration/Repository/ConsulFileConfigurationPoller.cs index 7e78b3aa..a2780062 100644 --- a/src/Ocelot/Configuration/Repository/ConsulFileConfigurationPoller.cs +++ b/src/Ocelot/Configuration/Repository/ConsulFileConfigurationPoller.cs @@ -34,7 +34,6 @@ namespace Ocelot.Configuration.Repository _polling = true; await Poll(); _polling = false; - }, null, 0, 1000); } diff --git a/src/Ocelot/Configuration/Repository/ConsulFileConfigurationRepository.cs b/src/Ocelot/Configuration/Repository/ConsulFileConfigurationRepository.cs index 91b4bd9d..746df5da 100644 --- a/src/Ocelot/Configuration/Repository/ConsulFileConfigurationRepository.cs +++ b/src/Ocelot/Configuration/Repository/ConsulFileConfigurationRepository.cs @@ -9,7 +9,6 @@ using Ocelot.ServiceDiscovery; namespace Ocelot.Configuration.Repository { - public class ConsulFileConfigurationRepository : IFileConfigurationRepository { private readonly ConsulClient _consul; @@ -76,4 +75,4 @@ namespace Ocelot.Configuration.Repository return new ErrorResponse(new UnableToSetConfigInConsulError($"Unable to set FileConfiguration in consul, response status code from consul was {result.StatusCode}")); } } -} \ No newline at end of file +} diff --git a/src/Ocelot/Configuration/Setter/FileConfigurationSetter.cs b/src/Ocelot/Configuration/Setter/FileConfigurationSetter.cs index 71f56277..38a7c1cb 100644 --- a/src/Ocelot/Configuration/Setter/FileConfigurationSetter.cs +++ b/src/Ocelot/Configuration/Setter/FileConfigurationSetter.cs @@ -12,7 +12,7 @@ namespace Ocelot.Configuration.Setter private readonly IOcelotConfigurationCreator _configCreator; private readonly IFileConfigurationRepository _repo; - public FileConfigurationSetter(IOcelotConfigurationRepository configRepo, + public FileConfigurationSetter(IOcelotConfigurationRepository configRepo, IOcelotConfigurationCreator configCreator, IFileConfigurationRepository repo) { _configRepo = configRepo; @@ -39,4 +39,4 @@ namespace Ocelot.Configuration.Setter return new ErrorResponse(config.Errors); } } -} \ No newline at end of file +} diff --git a/src/Ocelot/Configuration/Validator/FileValidationFailedError.cs b/src/Ocelot/Configuration/Validator/FileValidationFailedError.cs index b661e065..e90aa218 100644 --- a/src/Ocelot/Configuration/Validator/FileValidationFailedError.cs +++ b/src/Ocelot/Configuration/Validator/FileValidationFailedError.cs @@ -9,7 +9,6 @@ namespace Ocelot.Configuration.Validator { public FileValidationFailedError(string message) : base(message, OcelotErrorCode.FileValidationFailedError) { - } } } diff --git a/src/Ocelot/Configuration/Validator/ReRouteFluentValidator.cs b/src/Ocelot/Configuration/Validator/ReRouteFluentValidator.cs index f2ebbace..c2f4dc62 100644 --- a/src/Ocelot/Configuration/Validator/ReRouteFluentValidator.cs +++ b/src/Ocelot/Configuration/Validator/ReRouteFluentValidator.cs @@ -67,6 +67,7 @@ namespace Ocelot.Configuration.Validator { return true; } + var schemes = await _authenticationSchemeProvider.GetAllSchemesAsync(); var supportedSchemes = schemes.Select(scheme => scheme.Name).ToList(); diff --git a/src/Ocelot/DependencyInjection/OcelotBuilder.cs b/src/Ocelot/DependencyInjection/OcelotBuilder.cs index f4192713..6501b619 100644 --- a/src/Ocelot/DependencyInjection/OcelotBuilder.cs +++ b/src/Ocelot/DependencyInjection/OcelotBuilder.cs @@ -126,7 +126,7 @@ namespace Ocelot.DependencyInjection // see this for why we register this as singleton http://stackoverflow.com/questions/37371264/invalidoperationexception-unable-to-resolve-service-for-type-microsoft-aspnetc // could maybe use a scoped data repository - _services.TryAddSingleton(); + _services.TryAddSingleton(); _services.TryAddSingleton(); _services.AddMemoryCache(); _services.TryAddSingleton(); @@ -154,7 +154,6 @@ namespace Ocelot.DependencyInjection // We add this here so that we can always inject something into the factory for IoC.. _services.AddSingleton(); - } public IOcelotAdministrationBuilder AddAdministration(string path, string secret) diff --git a/src/Ocelot/DownstreamRouteFinder/DownstreamRoute.cs b/src/Ocelot/DownstreamRouteFinder/DownstreamRoute.cs index ed04daef..c7696ecf 100644 --- a/src/Ocelot/DownstreamRouteFinder/DownstreamRoute.cs +++ b/src/Ocelot/DownstreamRouteFinder/DownstreamRoute.cs @@ -11,7 +11,8 @@ namespace Ocelot.DownstreamRouteFinder TemplatePlaceholderNameAndValues = templatePlaceholderNameAndValues; ReRoute = reRoute; } + public List TemplatePlaceholderNameAndValues { get; private set; } public ReRoute ReRoute { get; private set; } } -} \ No newline at end of file +} diff --git a/src/Ocelot/DownstreamRouteFinder/UrlMatcher/UrlMatch.cs b/src/Ocelot/DownstreamRouteFinder/UrlMatcher/UrlMatch.cs index bfbd6fdc..9236ae39 100644 --- a/src/Ocelot/DownstreamRouteFinder/UrlMatcher/UrlMatch.cs +++ b/src/Ocelot/DownstreamRouteFinder/UrlMatcher/UrlMatch.cs @@ -6,6 +6,7 @@ namespace Ocelot.DownstreamRouteFinder.UrlMatcher { Match = match; } + public bool Match {get;private set;} } -} \ No newline at end of file +} diff --git a/src/Ocelot/DownstreamRouteFinder/UrlMatcher/UrlPathPlaceholderNameAndValue.cs b/src/Ocelot/DownstreamRouteFinder/UrlMatcher/UrlPathPlaceholderNameAndValue.cs index e299c770..f91faa1d 100644 --- a/src/Ocelot/DownstreamRouteFinder/UrlMatcher/UrlPathPlaceholderNameAndValue.cs +++ b/src/Ocelot/DownstreamRouteFinder/UrlMatcher/UrlPathPlaceholderNameAndValue.cs @@ -7,7 +7,8 @@ namespace Ocelot.DownstreamRouteFinder.UrlMatcher Name = name; Value = value; } + public string Name {get;private set;} public string Value {get;private set;} } -} \ No newline at end of file +} diff --git a/src/Ocelot/DownstreamRouteFinder/UrlMatcher/UrlPathPlaceholderNameAndValueFinder.cs b/src/Ocelot/DownstreamRouteFinder/UrlMatcher/UrlPathPlaceholderNameAndValueFinder.cs index 70cf2272..4471618f 100644 --- a/src/Ocelot/DownstreamRouteFinder/UrlMatcher/UrlPathPlaceholderNameAndValueFinder.cs +++ b/src/Ocelot/DownstreamRouteFinder/UrlMatcher/UrlPathPlaceholderNameAndValueFinder.cs @@ -50,6 +50,7 @@ namespace Ocelot.DownstreamRouteFinder.UrlMatcher counterForTemplate = endOfPlaceholder; } + counterForPath++; } @@ -90,6 +91,7 @@ namespace Ocelot.DownstreamRouteFinder.UrlMatcher return variableName; } + private int GetNextCounterPosition(string urlTemplate, int counterForTemplate, char delimiter) { var closingPlaceHolderPositionOnTemplate = urlTemplate.IndexOf(delimiter, counterForTemplate); @@ -111,4 +113,4 @@ namespace Ocelot.DownstreamRouteFinder.UrlMatcher return character == '{'; } } -} \ No newline at end of file +} diff --git a/src/Ocelot/Errors/Middleware/ExceptionHandlerMiddleware.cs b/src/Ocelot/Errors/Middleware/ExceptionHandlerMiddleware.cs index 9b49c84a..2b9e22e2 100644 --- a/src/Ocelot/Errors/Middleware/ExceptionHandlerMiddleware.cs +++ b/src/Ocelot/Errors/Middleware/ExceptionHandlerMiddleware.cs @@ -100,6 +100,7 @@ namespace Ocelot.Errors.Middleware message = $"{message}, inner exception message {e.InnerException.Message}, inner exception stack {e.InnerException.StackTrace}"; } + return $"{message} RequestId: {context.HttpContext.TraceIdentifier}"; } } diff --git a/src/Ocelot/Headers/HttpResponseHeaderReplacer.cs b/src/Ocelot/Headers/HttpResponseHeaderReplacer.cs index 347923ed..cb45ffc3 100644 --- a/src/Ocelot/Headers/HttpResponseHeaderReplacer.cs +++ b/src/Ocelot/Headers/HttpResponseHeaderReplacer.cs @@ -26,6 +26,7 @@ namespace Ocelot.Headers return $"{downstreamUrl}/"; }); } + public Response Replace(HttpResponseMessage response, List fAndRs, HttpRequestMessage httpRequestMessage) { foreach (var f in fAndRs) @@ -54,4 +55,4 @@ namespace Ocelot.Headers return new OkResponse(); } } -} \ No newline at end of file +} diff --git a/src/Ocelot/LoadBalancer/LoadBalancers/Lease.cs b/src/Ocelot/LoadBalancer/LoadBalancers/Lease.cs index 583b3002..2713d44b 100644 --- a/src/Ocelot/LoadBalancer/LoadBalancers/Lease.cs +++ b/src/Ocelot/LoadBalancer/LoadBalancers/Lease.cs @@ -9,6 +9,7 @@ namespace Ocelot.LoadBalancer.LoadBalancers HostAndPort = hostAndPort; Connections = connections; } + public ServiceHostAndPort HostAndPort { get; private set; } public int Connections { get; private set; } } diff --git a/src/Ocelot/Logging/IOcelotLoggerFactory.cs b/src/Ocelot/Logging/IOcelotLoggerFactory.cs index 29b4c9d0..3a145595 100644 --- a/src/Ocelot/Logging/IOcelotLoggerFactory.cs +++ b/src/Ocelot/Logging/IOcelotLoggerFactory.cs @@ -6,6 +6,7 @@ namespace Ocelot.Logging { IOcelotLogger CreateLogger(); } + /// /// Thin wrapper around the DotNet core logging framework, used to allow the scopedDataRepository to be injected giving access to the Ocelot RequestId /// diff --git a/src/Ocelot/Middleware/OcelotPipelineConfiguration.cs b/src/Ocelot/Middleware/OcelotPipelineConfiguration.cs index 3cfded9b..d58b8b09 100644 --- a/src/Ocelot/Middleware/OcelotPipelineConfiguration.cs +++ b/src/Ocelot/Middleware/OcelotPipelineConfiguration.cs @@ -37,7 +37,6 @@ /// /// This allows the user to implement there own query string manipulation logic /// - public Func, Task> PreQueryStringBuilderMiddleware { get; set; } - + public Func, Task> PreQueryStringBuilderMiddleware { get; set; } } } diff --git a/src/Ocelot/Raft/FakeCommand.cs b/src/Ocelot/Raft/FakeCommand.cs index 795ca7a5..45dd1045 100644 --- a/src/Ocelot/Raft/FakeCommand.cs +++ b/src/Ocelot/Raft/FakeCommand.cs @@ -8,8 +8,8 @@ namespace Ocelot.Raft public FakeCommand(string value) { this.Value = value; - } + public string Value { get; private set; } } } diff --git a/src/Ocelot/Raft/FilePeersProvider.cs b/src/Ocelot/Raft/FilePeersProvider.cs index aeca7b2c..1eddf5e3 100644 --- a/src/Ocelot/Raft/FilePeersProvider.cs +++ b/src/Ocelot/Raft/FilePeersProvider.cs @@ -37,6 +37,7 @@ namespace Ocelot.Raft _peers.Add(httpPeer); } } + public List Get() { return _peers; diff --git a/src/Ocelot/Raft/HttpPeer.cs b/src/Ocelot/Raft/HttpPeer.cs index ef76a583..34a94b27 100644 --- a/src/Ocelot/Raft/HttpPeer.cs +++ b/src/Ocelot/Raft/HttpPeer.cs @@ -28,7 +28,7 @@ namespace Ocelot.Raft { _identityServerConfiguration = identityServerConfiguration; _config = config; - Id = hostAndPort; + Id = hostAndPort; _hostAndPort = hostAndPort; _httpClient = httpClient; _jsonSerializerSettings = new JsonSerializerSettings() { @@ -68,6 +68,7 @@ namespace Ocelot.Raft { SetToken(); } + var json = JsonConvert.SerializeObject(appendEntries, _jsonSerializerSettings); var content = new StringContent(json); content.Headers.ContentType = new System.Net.Http.Headers.MediaTypeHeaderValue("application/json"); @@ -94,6 +95,7 @@ namespace Ocelot.Raft { SetToken(); } + var json = JsonConvert.SerializeObject(command, _jsonSerializerSettings); var content = new StringContent(json); content.Headers.ContentType = new System.Net.Http.Headers.MediaTypeHeaderValue("application/json"); diff --git a/src/Ocelot/Raft/SqlLiteLog.cs b/src/Ocelot/Raft/SqlLiteLog.cs index 098d9c06..9ca32af4 100644 --- a/src/Ocelot/Raft/SqlLiteLog.cs +++ b/src/Ocelot/Raft/SqlLiteLog.cs @@ -24,6 +24,7 @@ namespace Ocelot.Raft FileStream fs = File.Create(_path); fs.Dispose(); } + using(var connection = new SqliteConnection($"Data Source={_path};")) { connection.Open(); @@ -59,6 +60,7 @@ namespace Ocelot.Raft } } } + return result; } } @@ -88,6 +90,7 @@ namespace Ocelot.Raft } } } + return result; } } @@ -113,6 +116,7 @@ namespace Ocelot.Raft } } } + return result; } } @@ -222,15 +226,13 @@ namespace Ocelot.Raft }; var log = JsonConvert.DeserializeObject(data, jsonSerializerSettings); logsToReturn.Add((id, log)); - } } } } return logsToReturn; - } - + } } public long GetTermAtIndex(int index) @@ -256,9 +258,11 @@ namespace Ocelot.Raft } } } + return result; } } + public void Remove(int indexOfCommand) { lock(_lock) @@ -276,4 +280,4 @@ namespace Ocelot.Raft } } } -} \ No newline at end of file +} diff --git a/src/Ocelot/RateLimit/ClientRateLimitProcessor.cs b/src/Ocelot/RateLimit/ClientRateLimitProcessor.cs index 0415489c..9a4a4ce3 100644 --- a/src/Ocelot/RateLimit/ClientRateLimitProcessor.cs +++ b/src/Ocelot/RateLimit/ClientRateLimitProcessor.cs @@ -7,7 +7,6 @@ using System.Threading.Tasks; namespace Ocelot.RateLimit { - public class ClientRateLimitProcessor { private readonly IRateLimitCounterHandler _counterHandler; @@ -39,7 +38,5 @@ namespace Ocelot.RateLimit { return _core.ConvertToTimeSpan(timeSpan); } - } - } diff --git a/src/Ocelot/RateLimit/DistributedCacheRateLimitCounterHanlder.cs b/src/Ocelot/RateLimit/DistributedCacheRateLimitCounterHanlder.cs index ddcda184..91f933b7 100644 --- a/src/Ocelot/RateLimit/DistributedCacheRateLimitCounterHanlder.cs +++ b/src/Ocelot/RateLimit/DistributedCacheRateLimitCounterHanlder.cs @@ -34,6 +34,7 @@ namespace Ocelot.RateLimit { return JsonConvert.DeserializeObject(stored); } + return null; } diff --git a/src/Ocelot/RateLimit/Middleware/ClientRateLimitMiddleware.cs b/src/Ocelot/RateLimit/Middleware/ClientRateLimitMiddleware.cs index 064ec54b..2061decc 100644 --- a/src/Ocelot/RateLimit/Middleware/ClientRateLimitMiddleware.cs +++ b/src/Ocelot/RateLimit/Middleware/ClientRateLimitMiddleware.cs @@ -38,6 +38,7 @@ namespace Ocelot.RateLimit.Middleware await _next.Invoke(context); return; } + // compute identity from request var identity = SetIdentity(context.HttpContext, options); @@ -70,8 +71,8 @@ namespace Ocelot.RateLimit.Middleware return; } - } + //set X-Rate-Limit headers for the longest period if (!options.DisableRateLimitHeaders) { @@ -103,6 +104,7 @@ namespace Ocelot.RateLimit.Middleware { return true; } + return false; } @@ -134,8 +136,5 @@ namespace Ocelot.RateLimit.Middleware return Task.CompletedTask; } - } - } - diff --git a/src/Ocelot/RateLimit/RateLimitCore.cs b/src/Ocelot/RateLimit/RateLimitCore.cs index c3455682..cc027dfb 100644 --- a/src/Ocelot/RateLimit/RateLimitCore.cs +++ b/src/Ocelot/RateLimit/RateLimitCore.cs @@ -62,6 +62,7 @@ namespace Ocelot.RateLimit var expirationTime = ConvertToTimeSpan(rule.Period); _counterHandler.Set(counterId, counter, expirationTime); } + return counter; } @@ -92,7 +93,6 @@ namespace Ocelot.RateLimit rule.Period, rule.Limit.ToString(), (DateTime.UtcNow + ConvertToTimeSpan(rule.Period)).ToUniversalTime().ToString("o", DateTimeFormatInfo.InvariantInfo)); - } return headers; @@ -141,7 +141,6 @@ namespace Ocelot.RateLimit default: throw new FormatException($"{timeSpan} can't be converted to TimeSpan, unknown type {type}"); } - } - + } } } diff --git a/src/Ocelot/Requester/HttpClientHttpRequester.cs b/src/Ocelot/Requester/HttpClientHttpRequester.cs index a531d9b9..de9ea1c6 100644 --- a/src/Ocelot/Requester/HttpClientHttpRequester.cs +++ b/src/Ocelot/Requester/HttpClientHttpRequester.cs @@ -55,7 +55,6 @@ namespace Ocelot.Requester { _cacheHandlers.Set(cacheKey, httpClient, TimeSpan.FromHours(24)); } - } private IHttpClient GetHttpClient(string cacheKey, IHttpClientBuilder builder, DownstreamContext request) diff --git a/src/Ocelot/Requester/MemoryHttpClientCache.cs b/src/Ocelot/Requester/MemoryHttpClientCache.cs index 3ce1716b..e37a46a3 100644 --- a/src/Ocelot/Requester/MemoryHttpClientCache.cs +++ b/src/Ocelot/Requester/MemoryHttpClientCache.cs @@ -41,6 +41,7 @@ namespace Ocelot.Requester { connectionQueue.TryDequeue(out client); } + return client; } diff --git a/src/Ocelot/Requester/OcelotHttpTracingHandler.cs b/src/Ocelot/Requester/OcelotHttpTracingHandler.cs index e2658c7f..fbd24fbf 100644 --- a/src/Ocelot/Requester/OcelotHttpTracingHandler.cs +++ b/src/Ocelot/Requester/OcelotHttpTracingHandler.cs @@ -35,7 +35,7 @@ namespace Ocelot.Requester { request.Headers.Remove(prefix_spanId); request.Headers.TryAddWithoutValidation(prefix_spanId, span.SpanContext.SpanId); - }; + } span.Tags.Client().Component("HttpClient") .HttpMethod(request.Method.Method) diff --git a/src/Ocelot/Responder/HttpContextResponder.cs b/src/Ocelot/Responder/HttpContextResponder.cs index fbfbc6c2..7bc55d94 100644 --- a/src/Ocelot/Responder/HttpContextResponder.cs +++ b/src/Ocelot/Responder/HttpContextResponder.cs @@ -50,7 +50,6 @@ namespace Ocelot.Responder httpContext.Response.StatusCode = (int)response.StatusCode; return Task.CompletedTask; - }, context); using (Stream stream = new MemoryStream(content)) diff --git a/src/Ocelot/Responder/Middleware/ResponderMiddleware.cs b/src/Ocelot/Responder/Middleware/ResponderMiddleware.cs index bac062f8..4bfbad7a 100644 --- a/src/Ocelot/Responder/Middleware/ResponderMiddleware.cs +++ b/src/Ocelot/Responder/Middleware/ResponderMiddleware.cs @@ -29,7 +29,6 @@ namespace Ocelot.Responder.Middleware _responder = responder; _codeMapper = codeMapper; _logger = loggerFactory.CreateLogger(); - } public async Task Invoke(DownstreamContext context) diff --git a/src/Ocelot/Responses/ErrorResponse.cs b/src/Ocelot/Responses/ErrorResponse.cs index 28cd3f02..7a6688e7 100644 --- a/src/Ocelot/Responses/ErrorResponse.cs +++ b/src/Ocelot/Responses/ErrorResponse.cs @@ -8,8 +8,9 @@ namespace Ocelot.Responses public ErrorResponse(Error error) : base(new List{error}) { } + public ErrorResponse(List errors) : base(errors) { } } -} \ No newline at end of file +} diff --git a/src/Ocelot/Responses/ErrorResponseGeneric.cs b/src/Ocelot/Responses/ErrorResponseGeneric.cs index 837c2e5d..90a16cdd 100644 --- a/src/Ocelot/Responses/ErrorResponseGeneric.cs +++ b/src/Ocelot/Responses/ErrorResponseGeneric.cs @@ -7,12 +7,12 @@ namespace Ocelot.Responses { public ErrorResponse(Error error) : base(new List {error}) - { - + { } + public ErrorResponse(List errors) : base(errors) { } } -} \ No newline at end of file +} diff --git a/src/Ocelot/Responses/ResponseGeneric.cs b/src/Ocelot/Responses/ResponseGeneric.cs index 479dd08d..d06314bf 100644 --- a/src/Ocelot/Responses/ResponseGeneric.cs +++ b/src/Ocelot/Responses/ResponseGeneric.cs @@ -14,7 +14,6 @@ namespace Ocelot.Responses { } - public T Data { get; private set; } - + public T Data { get; private set; } } -} \ No newline at end of file +} diff --git a/src/Ocelot/ServiceDiscovery/ServiceDiscoveryProviderFactory.cs b/src/Ocelot/ServiceDiscovery/ServiceDiscoveryProviderFactory.cs index 0e75cb1a..09db94e4 100644 --- a/src/Ocelot/ServiceDiscovery/ServiceDiscoveryProviderFactory.cs +++ b/src/Ocelot/ServiceDiscovery/ServiceDiscoveryProviderFactory.cs @@ -14,7 +14,7 @@ namespace Ocelot.ServiceDiscovery _factory = factory; } - public IServiceDiscoveryProvider Get(ServiceProviderConfiguration serviceConfig, DownstreamReRoute reRoute) + public IServiceDiscoveryProvider Get(ServiceProviderConfiguration serviceConfig, DownstreamReRoute reRoute) { if (reRoute.UseServiceDiscovery) { diff --git a/src/Ocelot/Values/Service.cs b/src/Ocelot/Values/Service.cs index 1acb26e6..abf5449b 100644 --- a/src/Ocelot/Values/Service.cs +++ b/src/Ocelot/Values/Service.cs @@ -16,6 +16,7 @@ namespace Ocelot.Values Version = version; Tags = tags; } + public string Id { get; private set; } public string Name { get; private set; } diff --git a/test/Ocelot.AcceptanceTests/AuthorisationTests.cs b/test/Ocelot.AcceptanceTests/AuthorisationTests.cs index aaa4faff..06fee4ef 100644 --- a/test/Ocelot.AcceptanceTests/AuthorisationTests.cs +++ b/test/Ocelot.AcceptanceTests/AuthorisationTests.cs @@ -177,7 +177,7 @@ namespace Ocelot.AcceptanceTests AuthenticationOptions = new FileAuthenticationOptions { AuthenticationProviderKey = "Test", - AllowedScopes = new List{ "api", "api.readOnly", "openid", "offline_access" }, + AllowedScopes = new List{ "api", "api.readOnly", "openid", "offline_access" }, }, } } @@ -218,7 +218,7 @@ namespace Ocelot.AcceptanceTests AuthenticationOptions = new FileAuthenticationOptions { AuthenticationProviderKey = "Test", - AllowedScopes = new List{ "api", "openid", "offline_access" }, + AllowedScopes = new List{ "api", "openid", "offline_access" }, }, } } @@ -356,7 +356,6 @@ namespace Ocelot.AcceptanceTests "CustomerId", "LocationId", "UserType", "UserId" } }, - }) .AddInMemoryClients(new List { @@ -437,7 +436,6 @@ namespace Ocelot.AcceptanceTests "CustomerId", "LocationId", "UserType", "UserId", "Role" } }, - }) .AddInMemoryClients(new List { @@ -450,7 +448,6 @@ namespace Ocelot.AcceptanceTests AccessTokenType = tokenType, Enabled = true, RequireClientSecret = false, - } }) .AddTestUsers(users); diff --git a/test/Ocelot.AcceptanceTests/ButterflyTracingTests.cs b/test/Ocelot.AcceptanceTests/ButterflyTracingTests.cs index 84346985..52a589c1 100644 --- a/test/Ocelot.AcceptanceTests/ButterflyTracingTests.cs +++ b/test/Ocelot.AcceptanceTests/ButterflyTracingTests.cs @@ -52,7 +52,7 @@ namespace Ocelot.AcceptanceTests UpstreamHttpMethod = new List { "Get" }, HttpHandlerOptions = new FileHttpHandlerOptions { - UseTracing = true + UseTracing = true }, QoSOptions = new FileQoSOptions { @@ -77,7 +77,7 @@ namespace Ocelot.AcceptanceTests UpstreamHttpMethod = new List { "Get" }, HttpHandlerOptions = new FileHttpHandlerOptions { - UseTracing = true + UseTracing = true }, QoSOptions = new FileQoSOptions { diff --git a/test/Ocelot.AcceptanceTests/ClaimsToQueryStringForwardingTests.cs b/test/Ocelot.AcceptanceTests/ClaimsToQueryStringForwardingTests.cs index b8c1a59e..f73a360e 100644 --- a/test/Ocelot.AcceptanceTests/ClaimsToQueryStringForwardingTests.cs +++ b/test/Ocelot.AcceptanceTests/ClaimsToQueryStringForwardingTests.cs @@ -156,7 +156,7 @@ namespace Ocelot.AcceptanceTests { new ApiResource { - Name = apiName, + Name = apiName, Description = "My API", Enabled = true, DisplayName = "test", diff --git a/test/Ocelot.AcceptanceTests/ClientRateLimitTests.cs b/test/Ocelot.AcceptanceTests/ClientRateLimitTests.cs index 11ec83b1..fb09591b 100644 --- a/test/Ocelot.AcceptanceTests/ClientRateLimitTests.cs +++ b/test/Ocelot.AcceptanceTests/ClientRateLimitTests.cs @@ -56,7 +56,7 @@ namespace Ocelot.AcceptanceTests UpstreamHttpMethod = new List { "Get" }, RequestIdKey = _steps.RequestIdKey, - RateLimitOptions = new FileRateLimitRule() + RateLimitOptions = new FileRateLimitRule() { EnableRateLimiting = true, ClientWhitelist = new List(), @@ -75,7 +75,6 @@ namespace Ocelot.AcceptanceTests QuotaExceededMessage = "", RateLimitCounterPrefix = "", HttpStatusCode = 428 - }, RequestIdKey ="oceclientrequest" } @@ -117,7 +116,7 @@ namespace Ocelot.AcceptanceTests UpstreamHttpMethod = new List { "Get" }, RequestIdKey = _steps.RequestIdKey, - RateLimitOptions = new FileRateLimitRule() + RateLimitOptions = new FileRateLimitRule() { EnableRateLimiting = true, ClientWhitelist = new List() { "ocelotclient1"}, @@ -172,7 +171,5 @@ namespace Ocelot.AcceptanceTests _builder.Start(); } - - } } diff --git a/test/Ocelot.AcceptanceTests/CustomMiddlewareTests.cs b/test/Ocelot.AcceptanceTests/CustomMiddlewareTests.cs index 0f30ba73..2171f72d 100644 --- a/test/Ocelot.AcceptanceTests/CustomMiddlewareTests.cs +++ b/test/Ocelot.AcceptanceTests/CustomMiddlewareTests.cs @@ -352,7 +352,6 @@ namespace Ocelot.AcceptanceTests app.UsePathBase(basePath); app.Run(context => { - if(string.IsNullOrEmpty(basePath)) { context.Response.StatusCode = statusCode; diff --git a/test/Ocelot.AcceptanceTests/HttpDelegatingHandlersTests.cs b/test/Ocelot.AcceptanceTests/HttpDelegatingHandlersTests.cs index bb2a43df..c54294cd 100644 --- a/test/Ocelot.AcceptanceTests/HttpDelegatingHandlersTests.cs +++ b/test/Ocelot.AcceptanceTests/HttpDelegatingHandlersTests.cs @@ -70,8 +70,7 @@ namespace Ocelot.AcceptanceTests } class FakeHandler : DelegatingHandler - { - + { public DateTime TimeCalled { get; private set; } protected override async Task SendAsync(HttpRequestMessage request, CancellationToken cancellationToken) @@ -111,6 +110,5 @@ namespace Ocelot.AcceptanceTests _builder.Start(); } - } } diff --git a/test/Ocelot.AcceptanceTests/LoadBalancerTests.cs b/test/Ocelot.AcceptanceTests/LoadBalancerTests.cs index a5c5e07c..d67e7e41 100644 --- a/test/Ocelot.AcceptanceTests/LoadBalancerTests.cs +++ b/test/Ocelot.AcceptanceTests/LoadBalancerTests.cs @@ -159,8 +159,7 @@ namespace Ocelot.AcceptanceTests catch (System.Exception exception) { await context.Response.WriteAsync(exception.StackTrace); - } - + } }); }) .Build(); diff --git a/test/Ocelot.AcceptanceTests/QoSTests.cs b/test/Ocelot.AcceptanceTests/QoSTests.cs index e4f8a026..d11721b8 100644 --- a/test/Ocelot.AcceptanceTests/QoSTests.cs +++ b/test/Ocelot.AcceptanceTests/QoSTests.cs @@ -51,8 +51,7 @@ namespace Ocelot.AcceptanceTests ExceptionsAllowedBeforeBreaking = 1, TimeoutValue = 500, DurationOfBreak = 1000 - }, - + }, } } }; diff --git a/test/Ocelot.AcceptanceTests/ServiceDiscoveryTests.cs b/test/Ocelot.AcceptanceTests/ServiceDiscoveryTests.cs index 572c7126..97e104c4 100644 --- a/test/Ocelot.AcceptanceTests/ServiceDiscoveryTests.cs +++ b/test/Ocelot.AcceptanceTests/ServiceDiscoveryTests.cs @@ -359,8 +359,7 @@ namespace Ocelot.AcceptanceTests catch (System.Exception exception) { await context.Response.WriteAsync(exception.StackTrace); - } - + } }); }) .Build(); @@ -406,4 +405,4 @@ namespace Ocelot.AcceptanceTests _steps.Dispose(); } } -} \ No newline at end of file +} diff --git a/test/Ocelot.AcceptanceTests/Steps.cs b/test/Ocelot.AcceptanceTests/Steps.cs index 6a6fa3c4..09f68998 100644 --- a/test/Ocelot.AcceptanceTests/Steps.cs +++ b/test/Ocelot.AcceptanceTests/Steps.cs @@ -144,6 +144,7 @@ namespace Ocelot.AcceptanceTests _ocelotClient = _ocelotServer.CreateClient(); } + /* public void GivenIHaveAddedXForwardedForHeader(string value) { diff --git a/test/Ocelot.Benchmarks/Program.cs b/test/Ocelot.Benchmarks/Program.cs index 231a816b..56b87404 100644 --- a/test/Ocelot.Benchmarks/Program.cs +++ b/test/Ocelot.Benchmarks/Program.cs @@ -8,7 +8,6 @@ namespace Ocelot.Benchmarks { var switcher = new BenchmarkSwitcher(new[] { typeof(UrlPathToUrlPathTemplateMatcherBenchmarks), - }); switcher.Run(args); diff --git a/test/Ocelot.IntegrationTests/AdministrationTests.cs b/test/Ocelot.IntegrationTests/AdministrationTests.cs index 3b2f6a35..e9fc390d 100644 --- a/test/Ocelot.IntegrationTests/AdministrationTests.cs +++ b/test/Ocelot.IntegrationTests/AdministrationTests.cs @@ -124,7 +124,6 @@ namespace Ocelot.IntegrationTests { Host = "127.0.0.1", } - }, ReRoutes = new List() { diff --git a/test/Ocelot.IntegrationTests/RaftTests.cs b/test/Ocelot.IntegrationTests/RaftTests.cs index e93e9ee4..b8c24d5a 100644 --- a/test/Ocelot.IntegrationTests/RaftTests.cs +++ b/test/Ocelot.IntegrationTests/RaftTests.cs @@ -45,6 +45,7 @@ namespace Ocelot.IntegrationTests _builders = new List(); _threads = new List(); } + public void Dispose() { foreach (var builder in _builders) @@ -194,7 +195,6 @@ namespace Ocelot.IntegrationTests var stopwatch = Stopwatch.StartNew(); while(stopwatch.ElapsedMilliseconds < 10000) { - } } @@ -204,10 +204,9 @@ namespace Ocelot.IntegrationTests var stopwatch = Stopwatch.StartNew(); while(stopwatch.ElapsedMilliseconds < 2000) { - } - bool CommandCalledOnAllStateMachines() + bool CommandCalledOnAllStateMachines() { try { @@ -225,6 +224,7 @@ namespace Ocelot.IntegrationTests index.ShouldBe(1); } } + _httpClientForAssertions.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", _token.AccessToken); var result = _httpClientForAssertions.GetAsync($"{peer.HostAndPort}/administration/configuration").Result; var json = result.Content.ReadAsStringAsync().Result; @@ -248,6 +248,7 @@ namespace Ocelot.IntegrationTests response.ReRoutes[i].UpstreamPathTemplate.ShouldBe(expecteds.Configuration.ReRoutes[i].UpstreamPathTemplate); response.ReRoutes[i].UpstreamHttpMethod.ShouldBe(expecteds.Configuration.ReRoutes[i].UpstreamHttpMethod); } + passed++; } @@ -384,7 +385,6 @@ namespace Ocelot.IntegrationTests var stopwatch = Stopwatch.StartNew(); while(stopwatch.ElapsedMilliseconds < 20000) { - } } } diff --git a/test/Ocelot.IntegrationTests/ThreadSafeHeadersTests.cs b/test/Ocelot.IntegrationTests/ThreadSafeHeadersTests.cs index f8533a04..e61fa63b 100644 --- a/test/Ocelot.IntegrationTests/ThreadSafeHeadersTests.cs +++ b/test/Ocelot.IntegrationTests/ThreadSafeHeadersTests.cs @@ -195,6 +195,7 @@ namespace Ocelot.IntegrationTests result.Result.ShouldBe(result.Random); } } + public void Dispose() { _builder?.Dispose(); @@ -208,7 +209,6 @@ namespace Ocelot.IntegrationTests { Result = result; Random = random; - } public int Result { get; private set; } diff --git a/test/Ocelot.UnitTests/Authentication/AuthenticationMiddlewareTests.cs b/test/Ocelot.UnitTests/Authentication/AuthenticationMiddlewareTests.cs index 07368127..1ab81895 100644 --- a/test/Ocelot.UnitTests/Authentication/AuthenticationMiddlewareTests.cs +++ b/test/Ocelot.UnitTests/Authentication/AuthenticationMiddlewareTests.cs @@ -49,7 +49,7 @@ namespace Ocelot.UnitTests.Authentication .BDDfy(); } - private void WhenICallTheMiddleware() + private void WhenICallTheMiddleware() { _next = async (context) => { byte[] byteArray = Encoding.ASCII.GetBytes("The user is authenticated"); @@ -89,7 +89,7 @@ namespace Ocelot.UnitTests.Authentication { string text = reader.ReadToEnd(); return text; - }; + } } } } diff --git a/test/Ocelot.UnitTests/Authorization/ClaimsAuthoriserTests.cs b/test/Ocelot.UnitTests/Authorization/ClaimsAuthoriserTests.cs index 0333268b..e2990864 100644 --- a/test/Ocelot.UnitTests/Authorization/ClaimsAuthoriserTests.cs +++ b/test/Ocelot.UnitTests/Authorization/ClaimsAuthoriserTests.cs @@ -28,7 +28,6 @@ namespace Ocelot.UnitTests.Authorization this.Given(x => x.GivenAClaimsPrincipal(new ClaimsPrincipal(new ClaimsIdentity(new List { new Claim("UserType", "registered"), - })))) .And(x => x.GivenARouteClaimsRequirement(new Dictionary { diff --git a/test/Ocelot.UnitTests/Cache/OutputCacheMiddlewareTests.cs b/test/Ocelot.UnitTests/Cache/OutputCacheMiddlewareTests.cs index 42c1e695..31cc11a8 100644 --- a/test/Ocelot.UnitTests/Cache/OutputCacheMiddlewareTests.cs +++ b/test/Ocelot.UnitTests/Cache/OutputCacheMiddlewareTests.cs @@ -110,7 +110,6 @@ namespace Ocelot.UnitTests.Cache private void GivenThereAreNoErrors() { _downstreamContext.Errors = new List(); - } private void ThenTheCacheGetIsCalledCorrectly() diff --git a/test/Ocelot.UnitTests/Claims/AddClaimsToRequestTests.cs b/test/Ocelot.UnitTests/Claims/AddClaimsToRequestTests.cs index ac60ee8b..cdb5c4c7 100644 --- a/test/Ocelot.UnitTests/Claims/AddClaimsToRequestTests.cs +++ b/test/Ocelot.UnitTests/Claims/AddClaimsToRequestTests.cs @@ -129,7 +129,6 @@ namespace Ocelot.UnitTests.Claims private void ThenTheResultIsError() { - _result.IsError.ShouldBe(true); } diff --git a/test/Ocelot.UnitTests/Configuration/ClaimsToThingCreatorTests.cs b/test/Ocelot.UnitTests/Configuration/ClaimsToThingCreatorTests.cs index 656fe5dc..522d853f 100644 --- a/test/Ocelot.UnitTests/Configuration/ClaimsToThingCreatorTests.cs +++ b/test/Ocelot.UnitTests/Configuration/ClaimsToThingCreatorTests.cs @@ -79,6 +79,7 @@ namespace Ocelot.UnitTests.Configuration { _result.Count.ShouldBeGreaterThan(0); } + private void GivenTheFollowingDictionary(Dictionary claimsToThings) { _claimsToThings = claimsToThings; @@ -107,4 +108,4 @@ namespace Ocelot.UnitTests.Configuration .Verify(x => x.Extract(_claimsToThings.First().Key, _claimsToThings.First().Value), Times.Once); } } -} \ No newline at end of file +} diff --git a/test/Ocelot.UnitTests/Configuration/ConfigurationFluentValidationTests.cs b/test/Ocelot.UnitTests/Configuration/ConfigurationFluentValidationTests.cs index e7e56178..632461fc 100644 --- a/test/Ocelot.UnitTests/Configuration/ConfigurationFluentValidationTests.cs +++ b/test/Ocelot.UnitTests/Configuration/ConfigurationFluentValidationTests.cs @@ -981,7 +981,8 @@ namespace Ocelot.UnitTests.Configuration .And(x => x.ThenTheErrorMessageAtPositionIs(0, "When not using service discovery DownstreamHostAndPorts must be set and not empty or Ocelot cannot find your service!")) .BDDfy(); } - [Fact] + + [Fact] public void configuration_is_not_valid_when_host_and_port_is_empty() { this.Given(x => x.GivenAConfiguration(new FileConfiguration diff --git a/test/Ocelot.UnitTests/Configuration/ConsulFileConfigurationPollerTests.cs b/test/Ocelot.UnitTests/Configuration/ConsulFileConfigurationPollerTests.cs index 64104871..10c8a012 100644 --- a/test/Ocelot.UnitTests/Configuration/ConsulFileConfigurationPollerTests.cs +++ b/test/Ocelot.UnitTests/Configuration/ConsulFileConfigurationPollerTests.cs @@ -34,6 +34,7 @@ namespace Ocelot.UnitTests.Configuration _repo.Setup(x => x.Get()).ReturnsAsync(new OkResponse(_fileConfig)); _poller = new ConsulFileConfigurationPoller(_factory.Object, _repo.Object, _setter.Object); } + public void Dispose() { _poller.Dispose(); @@ -49,7 +50,6 @@ namespace Ocelot.UnitTests.Configuration [Fact] public void should_call_setter_when_gets_new_config() { - var newConfig = new FileConfiguration { ReRoutes = new List { diff --git a/test/Ocelot.UnitTests/Configuration/FileConfigurationCreatorTests.cs b/test/Ocelot.UnitTests/Configuration/FileConfigurationCreatorTests.cs index 8bb0ecd2..cb6615bf 100644 --- a/test/Ocelot.UnitTests/Configuration/FileConfigurationCreatorTests.cs +++ b/test/Ocelot.UnitTests/Configuration/FileConfigurationCreatorTests.cs @@ -823,8 +823,7 @@ namespace Ocelot.UnitTests.Configuration result.DownstreamReRoute[0].ClaimsToClaims.Count.ShouldBe(expected.DownstreamReRoute[0].ClaimsToClaims.Count); result.DownstreamReRoute[0].ClaimsToHeaders.Count.ShouldBe(expected.DownstreamReRoute[0].ClaimsToHeaders.Count); result.DownstreamReRoute[0].ClaimsToQueries.Count.ShouldBe(expected.DownstreamReRoute[0].ClaimsToQueries.Count); - result.DownstreamReRoute[0].RequestIdKey.ShouldBe(expected.DownstreamReRoute[0].RequestIdKey); - + result.DownstreamReRoute[0].RequestIdKey.ShouldBe(expected.DownstreamReRoute[0].RequestIdKey); } } diff --git a/test/Ocelot.UnitTests/Configuration/FileConfigurationRepositoryTests.cs b/test/Ocelot.UnitTests/Configuration/FileConfigurationRepositoryTests.cs index e74d0067..15dd3729 100644 --- a/test/Ocelot.UnitTests/Configuration/FileConfigurationRepositoryTests.cs +++ b/test/Ocelot.UnitTests/Configuration/FileConfigurationRepositoryTests.cs @@ -111,7 +111,7 @@ namespace Ocelot.UnitTests.Configuration } } - private void GivenTheConfigurationIs(FileConfiguration fileConfiguration) + private void GivenTheConfigurationIs(FileConfiguration fileConfiguration) { var configurationPath = $"{AppContext.BaseDirectory}/configuration{(string.IsNullOrEmpty(_environmentName) ? string.Empty : ".")}{_environmentName}.json"; diff --git a/test/Ocelot.UnitTests/Configuration/HeaderFindAndReplaceCreatorTests.cs b/test/Ocelot.UnitTests/Configuration/HeaderFindAndReplaceCreatorTests.cs index 76c3c47f..3c817295 100644 --- a/test/Ocelot.UnitTests/Configuration/HeaderFindAndReplaceCreatorTests.cs +++ b/test/Ocelot.UnitTests/Configuration/HeaderFindAndReplaceCreatorTests.cs @@ -33,13 +33,11 @@ namespace Ocelot.UnitTests.Configuration UpstreamHeaderTransform = new Dictionary { {"Test", "Test, Chicken"}, - {"Moop", "o, a"} }, DownstreamHeaderTransform = new Dictionary { {"Pop", "West, East"}, - {"Bop", "e, r"} } }; @@ -155,4 +153,4 @@ namespace Ocelot.UnitTests.Configuration } } } -} \ No newline at end of file +} diff --git a/test/Ocelot.UnitTests/Configuration/HttpHandlerOptionsCreatorTests.cs b/test/Ocelot.UnitTests/Configuration/HttpHandlerOptionsCreatorTests.cs index 3821ef6b..b0b11bfc 100644 --- a/test/Ocelot.UnitTests/Configuration/HttpHandlerOptionsCreatorTests.cs +++ b/test/Ocelot.UnitTests/Configuration/HttpHandlerOptionsCreatorTests.cs @@ -7,7 +7,6 @@ using Xunit; namespace Ocelot.UnitTests.Configuration { - public class HttpHandlerOptionsCreatorTests { private readonly IHttpHandlerOptionsCreator _httpHandlerOptionsCreator; diff --git a/test/Ocelot.UnitTests/Configuration/UpstreamTemplatePatternCreatorTests.cs b/test/Ocelot.UnitTests/Configuration/UpstreamTemplatePatternCreatorTests.cs index ab7fba4a..c8e79675 100644 --- a/test/Ocelot.UnitTests/Configuration/UpstreamTemplatePatternCreatorTests.cs +++ b/test/Ocelot.UnitTests/Configuration/UpstreamTemplatePatternCreatorTests.cs @@ -70,7 +70,7 @@ namespace Ocelot.UnitTests.Configuration [Fact] public void should_create_template_pattern_that_matches_anything_to_end_of_string() { - var fileReRoute = new FileReRoute + var fileReRoute = new FileReRoute { UpstreamPathTemplate = "/api/products/{productId}", ReRouteIsCaseSensitive = true @@ -181,4 +181,4 @@ namespace Ocelot.UnitTests.Configuration _result.Priority.ShouldBe(v); } } -} \ No newline at end of file +} diff --git a/test/Ocelot.UnitTests/DependencyInjection/OcelotBuilderTests.cs b/test/Ocelot.UnitTests/DependencyInjection/OcelotBuilderTests.cs index 6f256d7f..e33ee812 100644 --- a/test/Ocelot.UnitTests/DependencyInjection/OcelotBuilderTests.cs +++ b/test/Ocelot.UnitTests/DependencyInjection/OcelotBuilderTests.cs @@ -38,6 +38,7 @@ namespace Ocelot.UnitTests.DependencyInjection _services.AddSingleton(_configRoot); _maxRetries = 100; } + private Exception _ex; [Fact] @@ -102,9 +103,7 @@ namespace Ocelot.UnitTests.DependencyInjection [Fact] public void should_set_up_administration_with_identity_server_options() { - Action options = o => { - - }; + Action options = o => {}; this.Given(x => WhenISetUpOcelotServices()) .When(x => WhenISetUpAdministration(options)) diff --git a/test/Ocelot.UnitTests/Errors/ExceptionHandlerMiddlewareTests.cs b/test/Ocelot.UnitTests/Errors/ExceptionHandlerMiddlewareTests.cs index c5180f74..e6c3e7ca 100644 --- a/test/Ocelot.UnitTests/Errors/ExceptionHandlerMiddlewareTests.cs +++ b/test/Ocelot.UnitTests/Errors/ExceptionHandlerMiddlewareTests.cs @@ -135,7 +135,7 @@ namespace Ocelot.UnitTests.Errors private void GivenTheConfigThrows() { - var ex = new Exception("outer", new Exception("inner")); + var ex = new Exception("outer", new Exception("inner")); _provider .Setup(x => x.Get()).ThrowsAsync(ex); } @@ -192,7 +192,6 @@ namespace Ocelot.UnitTests.Errors private void ThenTheResponseIsError() { - _downstreamContext.HttpContext.Response.StatusCode.ShouldBe(500); } diff --git a/test/Ocelot.UnitTests/Headers/AddHeadersToRequestTests.cs b/test/Ocelot.UnitTests/Headers/AddHeadersToRequestTests.cs index f69c6b9e..0a8290bc 100644 --- a/test/Ocelot.UnitTests/Headers/AddHeadersToRequestTests.cs +++ b/test/Ocelot.UnitTests/Headers/AddHeadersToRequestTests.cs @@ -130,7 +130,6 @@ namespace Ocelot.UnitTests.Headers private void ThenTheResultIsError() { - _result.IsError.ShouldBe(true); } diff --git a/test/Ocelot.UnitTests/Headers/HttpHeadersTransformationMiddlewareTests.cs b/test/Ocelot.UnitTests/Headers/HttpHeadersTransformationMiddlewareTests.cs index 90a24eaa..0a69bf89 100644 --- a/test/Ocelot.UnitTests/Headers/HttpHeadersTransformationMiddlewareTests.cs +++ b/test/Ocelot.UnitTests/Headers/HttpHeadersTransformationMiddlewareTests.cs @@ -80,7 +80,6 @@ namespace Ocelot.UnitTests.Headers _downstreamContext.TemplatePlaceholderNameAndValues = dR.TemplatePlaceholderNameAndValues; _downstreamContext.DownstreamReRoute = dR.ReRoute.DownstreamReRoute[0]; - } private void ThenTheIHttpContextRequestHeaderReplacerIsCalledCorrectly() diff --git a/test/Ocelot.UnitTests/Headers/HttpResponseHeaderReplacerTests.cs b/test/Ocelot.UnitTests/Headers/HttpResponseHeaderReplacerTests.cs index de8161c9..6b65bb67 100644 --- a/test/Ocelot.UnitTests/Headers/HttpResponseHeaderReplacerTests.cs +++ b/test/Ocelot.UnitTests/Headers/HttpResponseHeaderReplacerTests.cs @@ -22,6 +22,7 @@ namespace Ocelot.UnitTests.Headers { _replacer = new HttpResponseHeaderReplacer(); } + [Fact] public void should_replace_headers() { @@ -232,4 +233,4 @@ namespace Ocelot.UnitTests.Headers } } } -} \ No newline at end of file +} diff --git a/test/Ocelot.UnitTests/Infrastructure/HttpDataRepositoryTests.cs b/test/Ocelot.UnitTests/Infrastructure/HttpDataRepositoryTests.cs index df5068d3..407e9f47 100644 --- a/test/Ocelot.UnitTests/Infrastructure/HttpDataRepositoryTests.cs +++ b/test/Ocelot.UnitTests/Infrastructure/HttpDataRepositoryTests.cs @@ -27,7 +27,6 @@ namespace Ocelot.UnitTests.Infrastructure [Fact] public void get_returns_correct_key_from_http_context() { - this.Given(x => x.GivenAHttpContextContaining("key", "string")) .When(x => x.GetIsCalledWithKey("key")) .Then(x => x.ThenTheResultIsAnOkResponse("string")) @@ -83,6 +82,5 @@ namespace Ocelot.UnitTests.Infrastructure _result.ShouldBeOfType>(); ((OkResponse)_result).Data.ShouldBe(resultValue); } - } } diff --git a/test/Ocelot.UnitTests/LoadBalancer/LeastConnectionTests.cs b/test/Ocelot.UnitTests/LoadBalancer/LeastConnectionTests.cs index e372ac4e..687f8f40 100644 --- a/test/Ocelot.UnitTests/LoadBalancer/LeastConnectionTests.cs +++ b/test/Ocelot.UnitTests/LoadBalancer/LeastConnectionTests.cs @@ -91,7 +91,6 @@ namespace Ocelot.UnitTests.LoadBalancer hostAndPortTwo.Data.DownstreamHost.ShouldBe("127.0.0.2"); _leastConnection.Release(hostAndPortOne.Data); _leastConnection.Release(hostAndPortTwo.Data); - } private async Task LeaseDelayAndRelease() diff --git a/test/Ocelot.UnitTests/LoadBalancer/LoadBalancerMiddlewareTests.cs b/test/Ocelot.UnitTests/LoadBalancer/LoadBalancerMiddlewareTests.cs index 310c1818..0af8b3af 100644 --- a/test/Ocelot.UnitTests/LoadBalancer/LoadBalancerMiddlewareTests.cs +++ b/test/Ocelot.UnitTests/LoadBalancer/LoadBalancerMiddlewareTests.cs @@ -188,7 +188,6 @@ namespace Ocelot.UnitTests.LoadBalancer { _downstreamContext.IsError.ShouldBeTrue(); _downstreamContext.Errors.ShouldBe(_getHostAndPortError.Errors); - } private void ThenTheDownstreamUrlIsReplacedWith(string expectedUri) diff --git a/test/Ocelot.UnitTests/Middleware/MultiplexerTests.cs b/test/Ocelot.UnitTests/Middleware/MultiplexerTests.cs index 8a0e5670..adef00d5 100644 --- a/test/Ocelot.UnitTests/Middleware/MultiplexerTests.cs +++ b/test/Ocelot.UnitTests/Middleware/MultiplexerTests.cs @@ -58,7 +58,6 @@ namespace Ocelot.UnitTests.Middleware private void WhenIMultiplex() { _multiplexer.Multiplex(_context, _reRoute, _pipeline).GetAwaiter().GetResult(); - } private void ThePipelineIsCalled(int expected) diff --git a/test/Ocelot.UnitTests/Request/DownstreamRequestInitialiserMiddlewareTests.cs b/test/Ocelot.UnitTests/Request/DownstreamRequestInitialiserMiddlewareTests.cs index 5661ace6..2bd26a4b 100644 --- a/test/Ocelot.UnitTests/Request/DownstreamRequestInitialiserMiddlewareTests.cs +++ b/test/Ocelot.UnitTests/Request/DownstreamRequestInitialiserMiddlewareTests.cs @@ -36,7 +36,6 @@ namespace Ocelot.UnitTests.Request public DownstreamRequestInitialiserMiddlewareTests() { - _httpContext = new Mock(); _httpRequest = new Mock(); _requestMapper = new Mock(); diff --git a/test/Ocelot.UnitTests/Requester/FakeDelegatingHandler.cs b/test/Ocelot.UnitTests/Requester/FakeDelegatingHandler.cs index 545e956e..a53487a3 100644 --- a/test/Ocelot.UnitTests/Requester/FakeDelegatingHandler.cs +++ b/test/Ocelot.UnitTests/Requester/FakeDelegatingHandler.cs @@ -9,13 +9,13 @@ namespace Ocelot.UnitTests.Requester { public FakeDelegatingHandler() { - } public FakeDelegatingHandler(int order) { Order = order; } + public int Order {get;private set;} public DateTime TimeCalled {get;private set;} @@ -25,4 +25,4 @@ namespace Ocelot.UnitTests.Requester return new HttpResponseMessage(); } } -} \ No newline at end of file +} diff --git a/test/Ocelot.UnitTests/ServiceDiscovery/ServiceRegistryTests.cs b/test/Ocelot.UnitTests/ServiceDiscovery/ServiceRegistryTests.cs index 8a41fe7e..1079f201 100644 --- a/test/Ocelot.UnitTests/ServiceDiscovery/ServiceRegistryTests.cs +++ b/test/Ocelot.UnitTests/ServiceDiscovery/ServiceRegistryTests.cs @@ -131,8 +131,7 @@ namespace Ocelot.UnitTests.ServiceDiscovery else { _registeredServices[serviceNameAndAddress.Name] = new List(){ serviceNameAndAddress }; - } - + } } } }