mirror of
				https://github.com/nsnail/Ocelot.git
				synced 2025-11-04 23:50:49 +08:00 
			
		
		
		
	* #441 added a test for this change * #441 bit of tidying up and fixing of erros
This commit is contained in:
		@@ -1,33 +1,24 @@
 | 
			
		||||
using System;
 | 
			
		||||
using System.Collections.Generic;
 | 
			
		||||
using System.IO;
 | 
			
		||||
using System.Linq;
 | 
			
		||||
using Consul;
 | 
			
		||||
using Microsoft.AspNetCore.Builder;
 | 
			
		||||
using Microsoft.AspNetCore.Hosting;
 | 
			
		||||
using Microsoft.AspNetCore.Http;
 | 
			
		||||
using Moq;
 | 
			
		||||
using Ocelot.Infrastructure.Consul;
 | 
			
		||||
using Ocelot.Logging;
 | 
			
		||||
using Ocelot.ServiceDiscovery.Configuration;
 | 
			
		||||
using Ocelot.ServiceDiscovery.Providers;
 | 
			
		||||
using Ocelot.Values;
 | 
			
		||||
using Xunit;
 | 
			
		||||
using TestStack.BDDfy;
 | 
			
		||||
using Shouldly;
 | 
			
		||||
using static Ocelot.Infrastructure.Wait;
 | 
			
		||||
 | 
			
		||||
namespace Ocelot.UnitTests.ServiceDiscovery
 | 
			
		||||
namespace Ocelot.UnitTests.ServiceDiscovery
 | 
			
		||||
{
 | 
			
		||||
    using System;
 | 
			
		||||
    using System.Collections.Generic;
 | 
			
		||||
    using Moq;
 | 
			
		||||
    using Ocelot.Logging;
 | 
			
		||||
    using Ocelot.ServiceDiscovery.Providers;
 | 
			
		||||
    using Ocelot.Values;
 | 
			
		||||
    using Xunit;
 | 
			
		||||
    using TestStack.BDDfy;
 | 
			
		||||
    using Shouldly;
 | 
			
		||||
    using static Ocelot.Infrastructure.Wait;
 | 
			
		||||
 | 
			
		||||
    public class PollingConsulServiceDiscoveryProviderTests
 | 
			
		||||
    {
 | 
			
		||||
        private readonly int _delay;
 | 
			
		||||
        private PollingConsulServiceDiscoveryProvider _provider;
 | 
			
		||||
        private readonly string _serviceName;
 | 
			
		||||
        private List<Service> _services;
 | 
			
		||||
        private readonly List<Service> _services;
 | 
			
		||||
        private readonly Mock<IOcelotLoggerFactory> _factory;
 | 
			
		||||
        private readonly Mock<IOcelotLogger> _logger;
 | 
			
		||||
        private Mock<IServiceDiscoveryProvider> _consulServiceDiscoveryProvider;
 | 
			
		||||
        private readonly Mock<IServiceDiscoveryProvider> _consulServiceDiscoveryProvider;
 | 
			
		||||
        private List<Service> _result;
 | 
			
		||||
 | 
			
		||||
        public PollingConsulServiceDiscoveryProviderTests()
 | 
			
		||||
@@ -64,7 +55,7 @@ namespace Ocelot.UnitTests.ServiceDiscovery
 | 
			
		||||
 | 
			
		||||
        private void WhenIGetTheServices(int expected)
 | 
			
		||||
        {
 | 
			
		||||
            _provider = new PollingConsulServiceDiscoveryProvider(_delay, _serviceName, _factory.Object, _consulServiceDiscoveryProvider.Object);
 | 
			
		||||
            _provider = new PollingConsulServiceDiscoveryProvider(_delay, "", _factory.Object, _consulServiceDiscoveryProvider.Object);
 | 
			
		||||
 | 
			
		||||
            var result = WaitFor(3000).Until(() => {
 | 
			
		||||
                try
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user