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,12 +1,11 @@
using System.Collections.Generic;
using System.Linq;
using System.Net.Http;
using System.Threading.Tasks;
using Moq;
using Ocelot.Infrastructure;
using Ocelot.Request.Creator;
using Ocelot.Request.Middleware;
using Shouldly;
using System.Collections.Generic;
using System.Net.Http;
using System.Threading.Tasks;
using TestStack.BDDfy;
using Xunit;
@ -47,7 +46,8 @@ namespace Ocelot.UnitTests.Request.Creator
var content = new StringContent("test");
request.Content = content;
methods.ForEach(m => {
methods.ForEach(m =>
{
this.Given(_ => GivenTheFrameworkIs(".NET Framework"))
.And(_ => GivenTheRequestIs(request))
.When(_ => WhenICreate())

View File

@ -2,38 +2,36 @@
namespace Ocelot.UnitTests.Request
{
using System.Net.Http;
using Microsoft.AspNetCore.Http;
using Moq;
using Ocelot.Infrastructure;
using Ocelot.Logging;
using Ocelot.Request.Creator;
using Ocelot.Request.Mapper;
using Ocelot.Request.Middleware;
using Ocelot.Infrastructure.RequestData;
using Ocelot.Responses;
using Shouldly;
using System.Net.Http;
using TestStack.BDDfy;
using Xunit;
using Ocelot.Responses;
using Ocelot.DownstreamRouteFinder.Middleware;
using Shouldly;
using Ocelot.Request.Creator;
using Ocelot.Infrastructure;
public class DownstreamRequestInitialiserMiddlewareTests
{
readonly DownstreamRequestInitialiserMiddleware _middleware;
private readonly DownstreamRequestInitialiserMiddleware _middleware;
readonly Mock<HttpContext> _httpContext;
private readonly Mock<HttpContext> _httpContext;
readonly Mock<HttpRequest> _httpRequest;
private readonly Mock<HttpRequest> _httpRequest;
readonly Mock<OcelotRequestDelegate> _next;
private readonly Mock<OcelotRequestDelegate> _next;
readonly Mock<IRequestMapper> _requestMapper;
private readonly Mock<IRequestMapper> _requestMapper;
readonly Mock<IOcelotLoggerFactory> _loggerFactory;
private readonly Mock<IOcelotLoggerFactory> _loggerFactory;
readonly Mock<IOcelotLogger> _logger;
private readonly Mock<IOcelotLogger> _logger;
Response<HttpRequestMessage> _mappedRequest;
private Response<HttpRequestMessage> _mappedRequest;
private DownstreamContext _downstreamContext;
public DownstreamRequestInitialiserMiddlewareTests()
@ -50,8 +48,8 @@ namespace Ocelot.UnitTests.Request
.Returns(_logger.Object);
_middleware = new DownstreamRequestInitialiserMiddleware(
_next.Object,
_loggerFactory.Object,
_next.Object,
_loggerFactory.Object,
_requestMapper.Object,
new DownstreamRequestCreator(new FrameworkDescription()));
@ -109,7 +107,7 @@ namespace Ocelot.UnitTests.Request
private void WhenTheMiddlewareIsInvoked()
{
_middleware.Invoke(_downstreamContext).GetAwaiter().GetResult();
_middleware.Invoke(_downstreamContext).GetAwaiter().GetResult();
}
private void ThenTheContexRequestIsMappedToADownstreamRequest()

View File

@ -1,7 +1,7 @@
using System;
using System.Net.Http;
using Ocelot.Request.Middleware;
using Shouldly;
using System;
using System.Net.Http;
using Xunit;
namespace Ocelot.UnitTests.Request

View File

@ -1,32 +1,31 @@
namespace Ocelot.UnitTests.Request.Mapper
{
using System.Collections.Generic;
using System.Linq;
using System.Net.Http;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Http.Internal;
using Microsoft.Extensions.Primitives;
using Ocelot.Request.Mapper;
using Ocelot.Responses;
using TestStack.BDDfy;
using Xunit;
using Shouldly;
using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
using System.Linq;
using System.Net.Http;
using System.Security.Cryptography;
using System.Text;
using System.Threading.Tasks;
using TestStack.BDDfy;
using Xunit;
public class RequestMapperTests
{
readonly HttpRequest _inputRequest;
private readonly HttpRequest _inputRequest;
readonly RequestMapper _requestMapper;
private readonly RequestMapper _requestMapper;
Response<HttpRequestMessage> _mappedRequest;
private Response<HttpRequestMessage> _mappedRequest;
List<KeyValuePair<string, StringValues>> _inputHeaders = null;
private List<KeyValuePair<string, StringValues>> _inputHeaders = null;
public RequestMapperTests()
{
@ -210,9 +209,9 @@
.And(_ => ThenTheMappedRequestHasContentTypeHeader("application/json"))
.And(_ => ThenTheMappedRequestHasContentSize("This is my content".Length))
.And(_ => ThenTheOtherContentTypeHeadersAreNotMapped())
.BDDfy();
.BDDfy();
}
private void ThenTheContentHeadersAreNotAddedToNonContentHeaders()
{
_mappedRequest.Data.Headers.ShouldNotContain(x => x.Key == "Content-Disposition");
@ -407,12 +406,12 @@
private void ThenTheMappedRequestHasEachHeader()
{
_mappedRequest.Data.Headers.Count().ShouldBe(_inputHeaders.Count);
foreach(var header in _mappedRequest.Data.Headers)
foreach (var header in _mappedRequest.Data.Headers)
{
var inputHeader = _inputHeaders.First(h => h.Key == header.Key);
inputHeader.ShouldNotBeNull();
inputHeader.Value.Count().ShouldBe(header.Value.Count());
foreach(var inputHeaderValue in inputHeader.Value)
foreach (var inputHeaderValue in inputHeader.Value)
{
header.Value.Any(v => v == inputHeaderValue);
}