mirror of
				https://github.com/nsnail/Ocelot.git
				synced 2025-11-04 22:10:49 +08:00 
			
		
		
		
	Feature/refactoring internal config creation stack (#600)
* tidy up some code so I can understand it * broke al the things that make config out into their own classes etc..sigh * fix the things i broked * #597 test for issue, works on this branch :E * #597 removed comments * added tests for new load balancer creator..basic * added tests for lb creator and aggregates creator * added tests for config creator * boiler plate for tests * added dynamics tests * wip * finished refactoring for now
This commit is contained in:
		@@ -37,7 +37,7 @@ namespace Ocelot.UnitTests.DownstreamRouteFinder
 | 
			
		||||
            _handlerOptions = new HttpHandlerOptionsBuilder().Build();
 | 
			
		||||
            _loadBalancerOptions = new LoadBalancerOptionsBuilder().WithType(nameof(NoLoadBalancer)).Build();
 | 
			
		||||
            _qosOptionsCreator
 | 
			
		||||
                .Setup(x => x.Create(It.IsAny<QoSOptions>(), It.IsAny<string>(), It.IsAny<string[]>()))
 | 
			
		||||
                .Setup(x => x.Create(It.IsAny<QoSOptions>(), It.IsAny<string>(), It.IsAny<List<string>>()))
 | 
			
		||||
                .Returns(_qoSOptions);
 | 
			
		||||
            _creator = new DownstreamRouteCreator(_qosOptionsCreator.Object);
 | 
			
		||||
        }
 | 
			
		||||
@@ -198,7 +198,7 @@ namespace Ocelot.UnitTests.DownstreamRouteFinder
 | 
			
		||||
        private void GivenTheQosCreatorReturns(QoSOptions options)
 | 
			
		||||
        {
 | 
			
		||||
            _qosOptionsCreator
 | 
			
		||||
                .Setup(x => x.Create(It.IsAny<QoSOptions>(), It.IsAny<string>(), It.IsAny<string[]>()))
 | 
			
		||||
                .Setup(x => x.Create(It.IsAny<QoSOptions>(), It.IsAny<string>(), It.IsAny<List<string>>()))
 | 
			
		||||
                .Returns(options);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
@@ -260,7 +260,7 @@ namespace Ocelot.UnitTests.DownstreamRouteFinder
 | 
			
		||||
            _result.Data.ReRoute.DownstreamReRoute[0].QosOptions.ShouldBe(expected);
 | 
			
		||||
            _result.Data.ReRoute.DownstreamReRoute[0].QosOptions.UseQos.ShouldBeTrue();
 | 
			
		||||
            _qosOptionsCreator
 | 
			
		||||
                .Verify(x => x.Create(expected, _upstreamUrlPath, It.IsAny<string[]>()), Times.Once);
 | 
			
		||||
                .Verify(x => x.Create(expected, _upstreamUrlPath, It.IsAny<List<string>>()), Times.Once);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        private void GivenTheConfiguration(IInternalConfiguration config)
 | 
			
		||||
 
 | 
			
		||||
@@ -459,7 +459,6 @@ namespace Ocelot.UnitTests.DownstreamRouteFinder
 | 
			
		||||
                                .WithDownstreamPathTemplate("someDownstreamPath")
 | 
			
		||||
                                .WithUpstreamHttpMethod(new List<string> { "Get" })
 | 
			
		||||
                                .WithUpstreamPathTemplate(new UpstreamPathTemplate("someUpstreamPath", 1, false, "someUpstreamPath"))
 | 
			
		||||
                                .WithUpstreamHost("MATCH")
 | 
			
		||||
                                .Build())
 | 
			
		||||
                            .WithUpstreamHttpMethod(new List<string> { "Get" })
 | 
			
		||||
                            .WithUpstreamPathTemplate(new UpstreamPathTemplate("someUpstreamPath", 1, false, "someUpstreamPath"))
 | 
			
		||||
@@ -545,7 +544,6 @@ namespace Ocelot.UnitTests.DownstreamRouteFinder
 | 
			
		||||
                                .WithDownstreamPathTemplate("someDownstreamPath")
 | 
			
		||||
                                .WithUpstreamHttpMethod(new List<string> { "Get" })
 | 
			
		||||
                                .WithUpstreamPathTemplate(new UpstreamPathTemplate("someUpstreamPath", 1, false, "someUpstreamPath"))
 | 
			
		||||
                                .WithUpstreamHost("MATCH")
 | 
			
		||||
                                .Build())
 | 
			
		||||
                            .WithUpstreamHttpMethod(new List<string> { "Get" })
 | 
			
		||||
                            .WithUpstreamPathTemplate(new UpstreamPathTemplate("someUpstreamPath", 1, false, "someUpstreamPath"))
 | 
			
		||||
@@ -556,7 +554,6 @@ namespace Ocelot.UnitTests.DownstreamRouteFinder
 | 
			
		||||
                                .WithDownstreamPathTemplate("someDownstreamPath")
 | 
			
		||||
                                .WithUpstreamHttpMethod(new List<string> { }) // empty list of methods
 | 
			
		||||
                                .WithUpstreamPathTemplate(new UpstreamPathTemplate("someUpstreamPath", 1, false, "someUpstreamPath"))
 | 
			
		||||
                                .WithUpstreamHost("MATCH")
 | 
			
		||||
                                .Build())
 | 
			
		||||
                            .WithUpstreamHttpMethod(new List<string> { }) // empty list of methods
 | 
			
		||||
                            .WithUpstreamPathTemplate(new UpstreamPathTemplate("someUpstreamPath", 1, false, "someUpstreamPath"))
 | 
			
		||||
@@ -587,7 +584,6 @@ namespace Ocelot.UnitTests.DownstreamRouteFinder
 | 
			
		||||
                                .WithDownstreamPathTemplate("someDownstreamPath")
 | 
			
		||||
                                .WithUpstreamHttpMethod(new List<string>())
 | 
			
		||||
                                .WithUpstreamPathTemplate(new UpstreamPathTemplate("someUpstreamPath", 1, false, "someUpstreamPath"))
 | 
			
		||||
                                .WithUpstreamHost("MATCH")
 | 
			
		||||
                                .Build())
 | 
			
		||||
                            .WithUpstreamHttpMethod(new List<string>())
 | 
			
		||||
                            .WithUpstreamPathTemplate(new UpstreamPathTemplate("someUpstreamPath", 1, false, "someUpstreamPath"))
 | 
			
		||||
@@ -618,7 +614,6 @@ namespace Ocelot.UnitTests.DownstreamRouteFinder
 | 
			
		||||
                                .WithDownstreamPathTemplate("someDownstreamPath")
 | 
			
		||||
                                .WithUpstreamHttpMethod(new List<string>())
 | 
			
		||||
                                .WithUpstreamPathTemplate(new UpstreamPathTemplate("someUpstreamPath", 1, false, "someUpstreamPath"))
 | 
			
		||||
                                .WithUpstreamHost("MATCH")
 | 
			
		||||
                                .Build())
 | 
			
		||||
                            .WithUpstreamHttpMethod(new List<string>())
 | 
			
		||||
                            .WithUpstreamPathTemplate(new UpstreamPathTemplate("someUpstreamPath", 1, false, "someUpstreamPath"))
 | 
			
		||||
@@ -659,7 +654,6 @@ namespace Ocelot.UnitTests.DownstreamRouteFinder
 | 
			
		||||
                                .WithDownstreamPathTemplate("someDownstreamPath")
 | 
			
		||||
                                .WithUpstreamHttpMethod(new List<string> { "Get" })
 | 
			
		||||
                                .WithUpstreamPathTemplate(new UpstreamPathTemplate("someUpstreamPath", 1, false, "someUpstreamPath"))
 | 
			
		||||
                                .WithUpstreamHost("MATCH")
 | 
			
		||||
                                .Build())
 | 
			
		||||
                            .WithUpstreamHttpMethod(new List<string> { "Get" })
 | 
			
		||||
                            .WithUpstreamPathTemplate(new UpstreamPathTemplate("someUpstreamPath", 1, false, "someUpstreamPath"))
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user