mirror of
				https://github.com/nsnail/Ocelot.git
				synced 2025-11-04 15:50:49 +08:00 
			
		
		
		
	@@ -2,7 +2,6 @@ using System;
 | 
			
		||||
using System.Collections.Generic;
 | 
			
		||||
using System.Linq;
 | 
			
		||||
using System.Net.Http;
 | 
			
		||||
using CacheManager.Core;
 | 
			
		||||
using Microsoft.AspNetCore.Hosting;
 | 
			
		||||
using Microsoft.AspNetCore.Hosting.Internal;
 | 
			
		||||
using Microsoft.Extensions.Configuration;
 | 
			
		||||
@@ -81,16 +80,6 @@ namespace Ocelot.UnitTests.DependencyInjection
 | 
			
		||||
                .BDDfy();
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        [Fact]
 | 
			
		||||
        public void should_set_up_cache_manager()
 | 
			
		||||
        {
 | 
			
		||||
            this.Given(x => WhenISetUpOcelotServices())
 | 
			
		||||
                .When(x => WhenISetUpCacheManager())
 | 
			
		||||
                .Then(x => ThenAnExceptionIsntThrown())
 | 
			
		||||
                .And(x => OnlyOneVersionOfEachCacheIsRegistered())
 | 
			
		||||
                .BDDfy();
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        [Fact]
 | 
			
		||||
        public void should_set_up_consul()
 | 
			
		||||
        {            
 | 
			
		||||
@@ -282,24 +271,6 @@ namespace Ocelot.UnitTests.DependencyInjection
 | 
			
		||||
            first.ShouldBe(second);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        private void OnlyOneVersionOfEachCacheIsRegistered()
 | 
			
		||||
        {
 | 
			
		||||
            var outputCache = _services.Single(x => x.ServiceType == typeof(IOcelotCache<CachedResponse>));
 | 
			
		||||
            var outputCacheManager = _services.Single(x => x.ServiceType == typeof(ICacheManager<CachedResponse>));
 | 
			
		||||
            var instance = (ICacheManager<CachedResponse>)outputCacheManager.ImplementationInstance;
 | 
			
		||||
            var ocelotConfigCache = _services.Single(x => x.ServiceType == typeof(IOcelotCache<IInternalConfiguration>));
 | 
			
		||||
            var ocelotConfigCacheManager = _services.Single(x => x.ServiceType == typeof(ICacheManager<IInternalConfiguration>));
 | 
			
		||||
            var fileConfigCache = _services.Single(x => x.ServiceType == typeof(IOcelotCache<FileConfiguration>));
 | 
			
		||||
            var fileConfigCacheManager = _services.Single(x => x.ServiceType == typeof(ICacheManager<FileConfiguration>));
 | 
			
		||||
 | 
			
		||||
            instance.Configuration.MaxRetries.ShouldBe(_maxRetries);
 | 
			
		||||
            outputCache.ShouldNotBeNull();
 | 
			
		||||
            ocelotConfigCache.ShouldNotBeNull();
 | 
			
		||||
            ocelotConfigCacheManager.ShouldNotBeNull();
 | 
			
		||||
            fileConfigCache.ShouldNotBeNull();
 | 
			
		||||
            fileConfigCacheManager.ShouldNotBeNull();
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        private void WhenISetUpConsul()
 | 
			
		||||
        {
 | 
			
		||||
            try
 | 
			
		||||
@@ -365,21 +336,6 @@ namespace Ocelot.UnitTests.DependencyInjection
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        private void WhenISetUpCacheManager()
 | 
			
		||||
        {
 | 
			
		||||
            try
 | 
			
		||||
            {
 | 
			
		||||
                _ocelotBuilder.AddCacheManager(x => {
 | 
			
		||||
                    x.WithMaxRetries(_maxRetries);
 | 
			
		||||
                    x.WithDictionaryHandle();
 | 
			
		||||
                });
 | 
			
		||||
            }
 | 
			
		||||
            catch (Exception e)
 | 
			
		||||
            {
 | 
			
		||||
                _ex = e;
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        private void WhenIAccessLoggerFactory()
 | 
			
		||||
        {
 | 
			
		||||
            try
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user