mirror of
				https://github.com/nsnail/Ocelot.git
				synced 2025-11-04 08:55:28 +08:00 
			
		
		
		
	@@ -24,7 +24,7 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        public string TimeoutStrategy { get; }
 | 
					        public string TimeoutStrategy { get; }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        public bool UseQos => ExceptionsAllowedBeforeBreaking > 0 && TimeoutValue > 0;
 | 
					        public bool UseQos => ExceptionsAllowedBeforeBreaking > 0 || TimeoutValue > 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        public string Key { get; }
 | 
					        public string Key { get; }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,21 +1,20 @@
 | 
				
			|||||||
using System;
 | 
					 | 
				
			||||||
using System.Collections.Generic;
 | 
					 | 
				
			||||||
using System.Net.Http;
 | 
					 | 
				
			||||||
using Microsoft.Extensions.DependencyInjection;
 | 
					 | 
				
			||||||
using Moq;
 | 
					 | 
				
			||||||
using Ocelot.Configuration;
 | 
					 | 
				
			||||||
using Ocelot.Configuration.Builder;
 | 
					 | 
				
			||||||
using Ocelot.Errors;
 | 
					 | 
				
			||||||
using Ocelot.Logging;
 | 
					 | 
				
			||||||
using Ocelot.Requester;
 | 
					 | 
				
			||||||
using Ocelot.Requester.QoS;
 | 
					 | 
				
			||||||
using Ocelot.Responses;
 | 
					 | 
				
			||||||
using Shouldly;
 | 
					 | 
				
			||||||
using TestStack.BDDfy;
 | 
					 | 
				
			||||||
using Xunit;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
namespace Ocelot.UnitTests.Requester
 | 
					namespace Ocelot.UnitTests.Requester
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
					    using System;
 | 
				
			||||||
 | 
					    using System.Collections.Generic;
 | 
				
			||||||
 | 
					    using System.Net.Http;
 | 
				
			||||||
 | 
					    using Microsoft.Extensions.DependencyInjection;
 | 
				
			||||||
 | 
					    using Moq;
 | 
				
			||||||
 | 
					    using Ocelot.Configuration;
 | 
				
			||||||
 | 
					    using Ocelot.Configuration.Builder;
 | 
				
			||||||
 | 
					    using Ocelot.Errors;
 | 
				
			||||||
 | 
					    using Ocelot.Logging;
 | 
				
			||||||
 | 
					    using Ocelot.Requester;
 | 
				
			||||||
 | 
					    using Ocelot.Requester.QoS;
 | 
				
			||||||
 | 
					    using Ocelot.Responses;
 | 
				
			||||||
 | 
					    using Shouldly;
 | 
				
			||||||
 | 
					    using TestStack.BDDfy;
 | 
				
			||||||
 | 
					    using Xunit;
 | 
				
			||||||
    using Responder;
 | 
					    using Responder;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public class DelegatingHandlerHandlerProviderFactoryTests
 | 
					    public class DelegatingHandlerHandlerProviderFactoryTests
 | 
				
			||||||
@@ -302,6 +301,26 @@ namespace Ocelot.UnitTests.Requester
 | 
				
			|||||||
                .BDDfy();
 | 
					                .BDDfy();
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        [Fact]
 | 
				
			||||||
 | 
					        public void should_return_provider_with_qos_delegate_when_timeout_value_set()
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            var qosOptions = new QoSOptionsBuilder()
 | 
				
			||||||
 | 
					                .WithTimeoutValue(1)
 | 
				
			||||||
 | 
					                .Build();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            var reRoute = new DownstreamReRouteBuilder()
 | 
				
			||||||
 | 
					                .WithQosOptions(qosOptions)
 | 
				
			||||||
 | 
					                .WithHttpHandlerOptions(new HttpHandlerOptions(true, true, false, true)).WithLoadBalancerKey("").Build();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            this.Given(x => GivenTheFollowingRequest(reRoute))
 | 
				
			||||||
 | 
					                .And(x => GivenTheQosFactoryReturns(new FakeQoSHandler()))
 | 
				
			||||||
 | 
					                .And(x => GivenTheServiceProviderReturnsNothing())
 | 
				
			||||||
 | 
					                .When(x => WhenIGet())
 | 
				
			||||||
 | 
					                .Then(x => ThenThereIsDelegatesInProvider(1))
 | 
				
			||||||
 | 
					                .And(x => ThenItIsQosHandler(0))
 | 
				
			||||||
 | 
					                .BDDfy();
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        [Fact]
 | 
					        [Fact]
 | 
				
			||||||
        public void should_log_error_and_return_no_qos_provider_delegate_when_qos_factory_returns_error()
 | 
					        public void should_log_error_and_return_no_qos_provider_delegate_when_qos_factory_returns_error()
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user