mirror of
				https://github.com/nsnail/Ocelot.git
				synced 2025-11-04 07:35:27 +08:00 
			
		
		
		
	Feature/#52 (#283)
* #52 test circle ci * #52 nicked some lads cake script * #52 put the mac build script back * #52 trying another lads circle CI thing doesnt use cake * #52 added test steps * #52 ports for linux build * #52 try travis mac build * #52 dont use build script * #52 dont use build script * #52 acceptance and int tests dont really work on mac...v strange? * #52 unique port for linux tests * #52 increase code coverage * #52 try using cake on linux for travis * #52 try using cake for mac and linux on travis * #52 dont run the acceptance and int tests on mac * #52 build.sh has lf line endings * #52 turns out crlf is OK for cake file..sigh * #52 not sure what return does in cake so wrapped in if just to see * #52 try use travis to work not run on mac * #52 dont need these references * #52 wrong property * #52 remove circle ci for linux and just use travis for all
This commit is contained in:
		@@ -0,0 +1,53 @@
 | 
			
		||||
using System.Threading.Tasks;
 | 
			
		||||
using Microsoft.AspNetCore.Http;
 | 
			
		||||
using Microsoft.Extensions.Configuration;
 | 
			
		||||
using Microsoft.Extensions.DependencyInjection;
 | 
			
		||||
using Moq;
 | 
			
		||||
using Ocelot.Configuration;
 | 
			
		||||
using Ocelot.Configuration.Builder;
 | 
			
		||||
using Ocelot.DependencyInjection;
 | 
			
		||||
using Ocelot.Middleware;
 | 
			
		||||
using Ocelot.Middleware.Multiplexer;
 | 
			
		||||
using Ocelot.Middleware.Pipeline;
 | 
			
		||||
using Shouldly;
 | 
			
		||||
using TestStack.BDDfy;
 | 
			
		||||
using Xunit;
 | 
			
		||||
 | 
			
		||||
namespace Ocelot.UnitTests.Middleware
 | 
			
		||||
{
 | 
			
		||||
    public class OcelotPipelineExtensionsTests
 | 
			
		||||
    {
 | 
			
		||||
        private OcelotPipelineBuilder _builder;
 | 
			
		||||
        private OcelotRequestDelegate _handlers;
 | 
			
		||||
 | 
			
		||||
        [Fact]
 | 
			
		||||
        public void should_set_up_pipeline()
 | 
			
		||||
        {
 | 
			
		||||
           this.Given(_ => GivenTheDepedenciesAreSetUp())
 | 
			
		||||
                .When(_ => WhenIBuild())
 | 
			
		||||
                .Then(_ => ThenThePipelineIsBuilt())
 | 
			
		||||
                .BDDfy();
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        private void ThenThePipelineIsBuilt()
 | 
			
		||||
        {
 | 
			
		||||
            _handlers.ShouldNotBeNull();
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        private void WhenIBuild()
 | 
			
		||||
        {
 | 
			
		||||
            _handlers = _builder.BuildOcelotPipeline(new OcelotPipelineConfiguration());
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        private void GivenTheDepedenciesAreSetUp()
 | 
			
		||||
        {
 | 
			
		||||
            IConfigurationBuilder test = new ConfigurationBuilder();
 | 
			
		||||
            var root = test.Build();
 | 
			
		||||
            var services = new ServiceCollection();
 | 
			
		||||
            services.AddSingleton<IConfiguration>(root);
 | 
			
		||||
            services.AddOcelot();
 | 
			
		||||
            var provider = services.BuildServiceProvider();
 | 
			
		||||
            _builder = new OcelotPipelineBuilder(provider);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user