private static SwaggerServiceDiscoveryProvider CreateProvider(Service service = null)
        {
            IServiceDiscoveryProviderFactory     serviceDiscovery     = Substitute.For <IServiceDiscoveryProviderFactory>();
            IServiceProviderConfigurationCreator configurationCreator = Substitute.For <IServiceProviderConfigurationCreator>();
            IOptionsMonitor <FileConfiguration>  options  = Substitute.For <IOptionsMonitor <FileConfiguration> >();
            IHttpContextAccessor      httpContextAccessor = Substitute.For <IHttpContextAccessor>();
            IOptions <SwaggerOptions> swaggerOptions      = Substitute.For <IOptions <SwaggerOptions> >();

            options.CurrentValue.Returns(new FileConfiguration());

            IServiceDiscoveryProvider serviceProvider = Substitute.For <IServiceDiscoveryProvider>();

            serviceProvider.Get().Returns(new List <Service>()
            {
                service
            });
            var response = new OkResponse <IServiceDiscoveryProvider>(serviceProvider);

            serviceDiscovery.Get(Arg.Any <ServiceProviderConfiguration>(), Arg.Any <DownstreamRoute>()).Returns(response);

            var provider = new SwaggerServiceDiscoveryProvider(
                serviceDiscovery, configurationCreator, options, httpContextAccessor, swaggerOptions);

            return(provider);
        }
コード例 #2
0
 public SwaggerServiceDiscoveryProvider(
     IServiceDiscoveryProviderFactory serviceDiscovery,
     IServiceProviderConfigurationCreator configurationCreator,
     IOptionsMonitor <FileConfiguration> options)
 {
     _serviceDiscovery     = serviceDiscovery;
     _configurationCreator = configurationCreator;
     _options = options;
 }
コード例 #3
0
 public SwaggerServiceDiscoveryProvider(
     IServiceDiscoveryProviderFactory serviceDiscovery,
     IServiceProviderConfigurationCreator configurationCreator,
     IOptionsMonitor <FileConfiguration> options,
     IHttpContextAccessor httpContextAccessor,
     IOptions <SwaggerOptions> swaggerOptions)
 {
     _serviceDiscovery     = serviceDiscovery;
     _configurationCreator = configurationCreator;
     _options             = options;
     _httpContextAccessor = httpContextAccessor;
     _swaggerOptions      = swaggerOptions;
 }
コード例 #4
0
 public LoadBalancerFactory(IServiceDiscoveryProviderFactory serviceProviderFactory, IEnumerable <ILoadBalancerCreator> loadBalancerCreators)
 {
     _serviceProviderFactory = serviceProviderFactory;
     _loadBalancerCreators   = loadBalancerCreators;
 }
コード例 #5
0
 public LoadBalancerFactory(IServiceDiscoveryProviderFactory serviceProviderFactory)
 {
     _serviceProviderFactory = serviceProviderFactory;
 }