mirror of
https://github.com/nsnail/Ocelot.git
synced 2025-06-19 16:28:17 +08:00
Removed unused usings, removed empty spaces, removed tons os warnings (#903)
This commit is contained in:
@ -1,8 +1,7 @@
|
||||
using System.Collections.Generic;
|
||||
using Ocelot.ServiceDiscovery;
|
||||
using Ocelot.ServiceDiscovery.Providers;
|
||||
using Ocelot.Values;
|
||||
using Shouldly;
|
||||
using System.Collections.Generic;
|
||||
using TestStack.BDDfy;
|
||||
using Xunit;
|
||||
|
||||
@ -50,4 +49,4 @@ namespace Ocelot.UnitTests.ServiceDiscovery
|
||||
_result[0].Name.ShouldBe(services[0].Name);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,20 +1,20 @@
|
||||
namespace Ocelot.UnitTests.ServiceDiscovery
|
||||
{
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Values;
|
||||
using System.Collections.Generic;
|
||||
using Moq;
|
||||
using Ocelot.Configuration;
|
||||
using Ocelot.Configuration.Builder;
|
||||
using Ocelot.Logging;
|
||||
using Ocelot.Responses;
|
||||
using Ocelot.ServiceDiscovery;
|
||||
using Ocelot.ServiceDiscovery.Providers;
|
||||
using Shouldly;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using TestStack.BDDfy;
|
||||
using Values;
|
||||
using Xunit;
|
||||
using Ocelot.Responses;
|
||||
|
||||
public class ServiceDiscoveryProviderFactoryTests
|
||||
{
|
||||
@ -35,7 +35,7 @@ namespace Ocelot.UnitTests.ServiceDiscovery
|
||||
_provider = _collection.BuildServiceProvider();
|
||||
_factory = new ServiceDiscoveryProviderFactory(_loggerFactory.Object, _provider);
|
||||
}
|
||||
|
||||
|
||||
[Fact]
|
||||
public void should_return_no_service_provider()
|
||||
{
|
||||
@ -135,7 +135,7 @@ namespace Ocelot.UnitTests.ServiceDiscovery
|
||||
_factory = new ServiceDiscoveryProviderFactory(_loggerFactory.Object, _provider);
|
||||
}
|
||||
|
||||
class Fake : IServiceDiscoveryProvider
|
||||
private class Fake : IServiceDiscoveryProvider
|
||||
{
|
||||
public Task<List<Service>> Get()
|
||||
{
|
||||
@ -157,7 +157,7 @@ namespace Ocelot.UnitTests.ServiceDiscovery
|
||||
{
|
||||
var result = (ConfigurationServiceProvider)_result.Data;
|
||||
var services = result.Get().Result;
|
||||
|
||||
|
||||
for (int i = 0; i < services.Count; i++)
|
||||
{
|
||||
var service = services[i];
|
||||
|
@ -1,12 +1,12 @@
|
||||
namespace Ocelot.UnitTests.ServiceDiscovery
|
||||
{
|
||||
using System.Collections.Generic;
|
||||
using Ocelot.Values;
|
||||
using Xunit;
|
||||
using TestStack.BDDfy;
|
||||
using Shouldly;
|
||||
using Ocelot.ServiceDiscovery.Configuration;
|
||||
using Ocelot.ServiceDiscovery.Providers;
|
||||
using Ocelot.Values;
|
||||
using Shouldly;
|
||||
using System.Collections.Generic;
|
||||
using TestStack.BDDfy;
|
||||
using Xunit;
|
||||
|
||||
public class ServiceFabricServiceDiscoveryProviderTests
|
||||
{
|
||||
|
@ -1,6 +1,6 @@
|
||||
using System.Collections.Generic;
|
||||
using Ocelot.Values;
|
||||
using Shouldly;
|
||||
using System.Collections.Generic;
|
||||
using TestStack.BDDfy;
|
||||
using Xunit;
|
||||
|
||||
@ -78,17 +78,19 @@ namespace Ocelot.UnitTests.ServiceDiscovery
|
||||
public interface IServiceRegistry
|
||||
{
|
||||
void Register(Service serviceNameAndAddress);
|
||||
|
||||
List<Service> Lookup(string name);
|
||||
}
|
||||
|
||||
public class ServiceRegistry : IServiceRegistry
|
||||
{
|
||||
private readonly IServiceRepository _repository;
|
||||
|
||||
public ServiceRegistry(IServiceRepository repository)
|
||||
{
|
||||
_repository = repository;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void Register(Service serviceNameAndAddress)
|
||||
{
|
||||
_repository.Set(serviceNameAndAddress);
|
||||
@ -103,6 +105,7 @@ namespace Ocelot.UnitTests.ServiceDiscovery
|
||||
public interface IServiceRepository
|
||||
{
|
||||
List<Service> Get(string serviceName);
|
||||
|
||||
void Set(Service serviceNameAndAddress);
|
||||
}
|
||||
|
||||
@ -123,15 +126,15 @@ namespace Ocelot.UnitTests.ServiceDiscovery
|
||||
public void Set(Service serviceNameAndAddress)
|
||||
{
|
||||
List<Service> services;
|
||||
if(_registeredServices.TryGetValue(serviceNameAndAddress.Name, out services))
|
||||
if (_registeredServices.TryGetValue(serviceNameAndAddress.Name, out services))
|
||||
{
|
||||
services.Add(serviceNameAndAddress);
|
||||
_registeredServices[serviceNameAndAddress.Name] = services;
|
||||
}
|
||||
else
|
||||
{
|
||||
_registeredServices[serviceNameAndAddress.Name] = new List<Service>(){ serviceNameAndAddress };
|
||||
}
|
||||
{
|
||||
_registeredServices[serviceNameAndAddress.Name] = new List<Service>() { serviceNameAndAddress };
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user