Removed unused usings, removed empty spaces, removed tons os warnings (#903)

This commit is contained in:
Thiago Loureiro
2019-05-28 11:00:54 +08:00
committed by GitHub
parent 4476f8273e
commit 5d82e68534
486 changed files with 3049 additions and 3143 deletions

View File

@ -1,19 +1,18 @@
namespace Ocelot.UnitTests.DownstreamRouteFinder
{
using System;
using Moq;
using Ocelot.Configuration;
using Ocelot.Configuration.Builder;
using Ocelot.Configuration.Creator;
using Ocelot.DownstreamRouteFinder;
using Ocelot.DownstreamRouteFinder.Finder;
using Ocelot.LoadBalancer.LoadBalancers;
using Responses;
using TestStack.BDDfy;
using Ocelot.DownstreamRouteFinder.Finder;
using Xunit;
using Shouldly;
using Ocelot.Configuration;
using System.Net.Http;
using System.Collections.Generic;
using System.Net.Http;
using TestStack.BDDfy;
using Xunit;
public class DownstreamRouteCreatorTests
{
@ -71,7 +70,7 @@ namespace Ocelot.UnitTests.DownstreamRouteFinder
.Build();
var reRoutes = new List<ReRoute> { reRoute };
var configuration = new InternalConfiguration(reRoutes, "doesnt matter", null, "doesnt matter", _loadBalancerOptions, "http", _qoSOptions, _handlerOptions);
this.Given(_ => GivenTheConfiguration(configuration))
@ -224,7 +223,6 @@ namespace Ocelot.UnitTests.DownstreamRouteFinder
_result.Data.ReRoute.DownstreamReRoute[0].QosOptions.ShouldBe(_qoSOptions);
_result.Data.ReRoute.UpstreamTemplatePattern.ShouldNotBeNull();
_result.Data.ReRoute.DownstreamReRoute[0].UpstreamPathTemplate.ShouldNotBeNull();
}
private void ThenTheDownstreamPathIsForwardSlash()

View File

@ -1,7 +1,5 @@
namespace Ocelot.UnitTests.DownstreamRouteFinder
{
using System.Collections.Generic;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Http;
using Moq;
using Ocelot.Configuration;
@ -11,13 +9,14 @@
using Ocelot.DownstreamRouteFinder.Middleware;
using Ocelot.DownstreamRouteFinder.UrlMatcher;
using Ocelot.Logging;
using Ocelot.Responses;
using Shouldly;
using TestStack.BDDfy;
using Xunit;
using Ocelot.Configuration.Repository;
using Ocelot.Middleware;
using Ocelot.Middleware.Multiplexer;
using Ocelot.Responses;
using Shouldly;
using System.Collections.Generic;
using System.Threading.Tasks;
using TestStack.BDDfy;
using Xunit;
public class DownstreamRouteFinderMiddlewareTests
{
@ -53,12 +52,12 @@
var downstreamReRoute = new DownstreamReRouteBuilder()
.WithDownstreamPathTemplate("any old string")
.WithUpstreamHttpMethod(new List<string> {"Get"})
.WithUpstreamHttpMethod(new List<string> { "Get" })
.Build();
this.Given(x => x.GivenTheDownStreamRouteFinderReturns(
new DownstreamRoute(
new List<PlaceholderNameAndValue>(),
new List<PlaceholderNameAndValue>(),
new ReRouteBuilder()
.WithDownstreamReRoute(downstreamReRoute)
.WithUpstreamHttpMethod(new List<string> { "Get" })

View File

@ -1,5 +1,4 @@
using System.Collections.Generic;
using Moq;
using Moq;
using Ocelot.Configuration;
using Ocelot.Configuration.Builder;
using Ocelot.DownstreamRouteFinder;
@ -8,6 +7,7 @@ using Ocelot.DownstreamRouteFinder.UrlMatcher;
using Ocelot.Responses;
using Ocelot.Values;
using Shouldly;
using System.Collections.Generic;
using TestStack.BDDfy;
using Xunit;
@ -132,7 +132,7 @@ namespace Ocelot.UnitTests.DownstreamRouteFinder
var serviceProviderConfig = new ServiceProviderConfigurationBuilder().Build();
this.Given(x => x.GivenThereIsAnUpstreamUrlPath("matchInUrlMatcher/"))
.And(x =>x.GivenTheTemplateVariableAndNameFinderReturns(
.And(x => x.GivenTheTemplateVariableAndNameFinderReturns(
new OkResponse<List<PlaceholderNameAndValue>>(
new List<PlaceholderNameAndValue>())))
.And(x => x.GivenTheConfigurationIs(new List<ReRoute>
@ -174,7 +174,7 @@ namespace Ocelot.UnitTests.DownstreamRouteFinder
var serviceProviderConfig = new ServiceProviderConfigurationBuilder().Build();
this.Given(x => x.GivenThereIsAnUpstreamUrlPath("matchInUrlMatcher"))
.And(x =>x.GivenTheTemplateVariableAndNameFinderReturns(
.And(x => x.GivenTheTemplateVariableAndNameFinderReturns(
new OkResponse<List<PlaceholderNameAndValue>>(
new List<PlaceholderNameAndValue>())))
.And(x => x.GivenTheConfigurationIs(new List<ReRoute>
@ -303,7 +303,7 @@ namespace Ocelot.UnitTests.DownstreamRouteFinder
[Fact]
public void should_not_return_route()
{
{
var serviceProviderConfig = new ServiceProviderConfigurationBuilder().Build();
this.Given(x => x.GivenThereIsAnUpstreamUrlPath("dontMatchPath/"))
@ -317,7 +317,7 @@ namespace Ocelot.UnitTests.DownstreamRouteFinder
.Build())
.WithUpstreamHttpMethod(new List<string> { "Get" })
.WithUpstreamPathTemplate(new UpstreamPathTemplate("somePath", 1, false, "someUpstreamPath"))
.Build(),
.Build(),
}, string.Empty, serviceProviderConfig
))
.And(x => x.GivenTheUrlMatcherReturns(new OkResponse<UrlMatch>(new UrlMatch(false))))
@ -762,7 +762,7 @@ namespace Ocelot.UnitTests.DownstreamRouteFinder
_result.Data.TemplatePlaceholderNameAndValues[i].Name.ShouldBe(expected.TemplatePlaceholderNameAndValues[i].Name);
_result.Data.TemplatePlaceholderNameAndValues[i].Value.ShouldBe(expected.TemplatePlaceholderNameAndValues[i].Value);
}
_result.IsError.ShouldBeFalse();
}
}

View File

@ -1,17 +1,17 @@
namespace Ocelot.UnitTests.DownstreamRouteFinder
{
using System.Collections.Generic;
using Microsoft.Extensions.DependencyInjection;
using Moq;
using Ocelot.Configuration;
using Ocelot.Configuration.Builder;
using Ocelot.Configuration.Creator;
using Ocelot.DownstreamRouteFinder.Finder;
using Ocelot.DownstreamRouteFinder.UrlMatcher;
using Ocelot.Logging;
using Shouldly;
using System.Collections.Generic;
using TestStack.BDDfy;
using Xunit;
using Ocelot.Configuration.Creator;
using Ocelot.Logging;
public class DownstreamRouteProviderFactoryTests
{

View File

@ -1,14 +1,14 @@
using System.Collections.Generic;
using System.Linq;
using Ocelot.DownstreamRouteFinder.UrlMatcher;
using Ocelot.Responses;
using Shouldly;
using System.Collections.Generic;
using System.Linq;
using TestStack.BDDfy;
using Xunit;
namespace Ocelot.UnitTests.DownstreamRouteFinder.UrlMatcher
{
public class UrlPathPlaceholderNameAndValueFinderTests
public class UrlPathPlaceholderNameAndValueFinderTests
{
private readonly IPlaceholderNameAndValueFinder _finder;
private string _downstreamUrlPath;
@ -34,7 +34,7 @@ namespace Ocelot.UnitTests.DownstreamRouteFinder.UrlMatcher
[Fact]
public void can_match_down_stream_url_with_nothing_then_placeholder_no_value_is_blank()
{
var expectedTemplates = new List<PlaceholderNameAndValue>
var expectedTemplates = new List<PlaceholderNameAndValue>
{
new PlaceholderNameAndValue("{url}", "")
};
@ -49,7 +49,7 @@ namespace Ocelot.UnitTests.DownstreamRouteFinder.UrlMatcher
[Fact]
public void can_match_down_stream_url_with_nothing_then_placeholder_value_is_test()
{
var expectedTemplates = new List<PlaceholderNameAndValue>
var expectedTemplates = new List<PlaceholderNameAndValue>
{
new PlaceholderNameAndValue("{url}", "test")
};
@ -64,7 +64,7 @@ namespace Ocelot.UnitTests.DownstreamRouteFinder.UrlMatcher
[Fact]
public void should_match_everything_in_path_with_query()
{
var expectedTemplates = new List<PlaceholderNameAndValue>
var expectedTemplates = new List<PlaceholderNameAndValue>
{
new PlaceholderNameAndValue("{everything}", "test/toot")
};
@ -80,7 +80,7 @@ namespace Ocelot.UnitTests.DownstreamRouteFinder.UrlMatcher
[Fact]
public void should_match_everything_in_path()
{
var expectedTemplates = new List<PlaceholderNameAndValue>
var expectedTemplates = new List<PlaceholderNameAndValue>
{
new PlaceholderNameAndValue("{everything}", "test/toot")
};
@ -95,7 +95,7 @@ namespace Ocelot.UnitTests.DownstreamRouteFinder.UrlMatcher
[Fact]
public void can_match_down_stream_url_with_forward_slash_then_placeholder_no_value_is_blank()
{
var expectedTemplates = new List<PlaceholderNameAndValue>
var expectedTemplates = new List<PlaceholderNameAndValue>
{
new PlaceholderNameAndValue("{url}", "")
};
@ -110,7 +110,7 @@ namespace Ocelot.UnitTests.DownstreamRouteFinder.UrlMatcher
[Fact]
public void can_match_down_stream_url_with_forward_slash()
{
var expectedTemplates = new List<PlaceholderNameAndValue>
var expectedTemplates = new List<PlaceholderNameAndValue>
{
};
@ -124,7 +124,7 @@ namespace Ocelot.UnitTests.DownstreamRouteFinder.UrlMatcher
[Fact]
public void can_match_down_stream_url_with_forward_slash_then_placeholder_then_another_value()
{
var expectedTemplates = new List<PlaceholderNameAndValue>
var expectedTemplates = new List<PlaceholderNameAndValue>
{
new PlaceholderNameAndValue("{url}", "1")
};
@ -264,7 +264,7 @@ namespace Ocelot.UnitTests.DownstreamRouteFinder.UrlMatcher
[Fact]
public void can_match_down_stream_url_with_downstream_template_with_one_place_holder()
{
var expectedTemplates = new List<PlaceholderNameAndValue>
var expectedTemplates = new List<PlaceholderNameAndValue>
{
new PlaceholderNameAndValue("{productId}", "1")
};
@ -279,7 +279,7 @@ namespace Ocelot.UnitTests.DownstreamRouteFinder.UrlMatcher
[Fact]
public void can_match_down_stream_url_with_downstream_template_with_two_place_holders()
{
var expectedTemplates = new List<PlaceholderNameAndValue>
var expectedTemplates = new List<PlaceholderNameAndValue>
{
new PlaceholderNameAndValue("{productId}", "1"),
new PlaceholderNameAndValue("{categoryId}", "2")
@ -295,7 +295,7 @@ namespace Ocelot.UnitTests.DownstreamRouteFinder.UrlMatcher
[Fact]
public void can_match_down_stream_url_with_downstream_template_with_two_place_holders_seperated_by_something()
{
var expectedTemplates = new List<PlaceholderNameAndValue>
var expectedTemplates = new List<PlaceholderNameAndValue>
{
new PlaceholderNameAndValue("{productId}", "1"),
new PlaceholderNameAndValue("{categoryId}", "2")
@ -311,7 +311,7 @@ namespace Ocelot.UnitTests.DownstreamRouteFinder.UrlMatcher
[Fact]
public void can_match_down_stream_url_with_downstream_template_with_three_place_holders_seperated_by_something()
{
var expectedTemplates = new List<PlaceholderNameAndValue>
var expectedTemplates = new List<PlaceholderNameAndValue>
{
new PlaceholderNameAndValue("{productId}", "1"),
new PlaceholderNameAndValue("{categoryId}", "2"),
@ -328,7 +328,7 @@ namespace Ocelot.UnitTests.DownstreamRouteFinder.UrlMatcher
[Fact]
public void can_match_down_stream_url_with_downstream_template_with_three_place_holders()
{
var expectedTemplates = new List<PlaceholderNameAndValue>
var expectedTemplates = new List<PlaceholderNameAndValue>
{
new PlaceholderNameAndValue("{productId}", "1"),
new PlaceholderNameAndValue("{categoryId}", "2")
@ -385,4 +385,4 @@ namespace Ocelot.UnitTests.DownstreamRouteFinder.UrlMatcher
_query = query;
}
}
}
}