コード例 #1
0
        private void GivenTheConfigKeyComesFromFileConfig(string key)
        {
            _internalRepo
            .Setup(x => x.Get())
            .Returns(new OkResponse <IInternalConfiguration>(new InternalConfiguration(new List <ReRoute>(), "", new ServiceProviderConfigurationBuilder().WithConfigurationKey(key).Build(), "")));

            _repo = new ConsulFileConfigurationRepository(_cache.Object, _internalRepo.Object, _factory.Object, _loggerFactory.Object);
        }
コード例 #2
0
        public ConsulFileConfigurationRepositoryTests()
        {
            _cache         = new Mock <IOcelotCache <FileConfiguration> >();
            _internalRepo  = new Mock <IInternalConfigurationRepository>();
            _loggerFactory = new Mock <IOcelotLoggerFactory>();

            _factory    = new Mock <IConsulClientFactory>();
            _client     = new Mock <IConsulClient>();
            _kvEndpoint = new Mock <IKVEndpoint>();

            _client
            .Setup(x => x.KV)
            .Returns(_kvEndpoint.Object);
            _factory
            .Setup(x => x.Get(It.IsAny <ConsulRegistryConfiguration>()))
            .Returns(_client.Object);

            _internalRepo
            .Setup(x => x.Get())
            .Returns(new OkResponse <IInternalConfiguration>(new InternalConfiguration(new List <ReRoute>(), "", new ServiceProviderConfigurationBuilder().Build(), "")));

            _repo = new ConsulFileConfigurationRepository(_cache.Object, _internalRepo.Object, _factory.Object, _loggerFactory.Object);
        }
コード例 #3
0
        private void GivenIHaveAConfiguration(FileConfiguration config)
        {
            _fileConfiguration = config;

            _repo = new ConsulFileConfigurationRepository(_options.Object, _cache.Object, _factory.Object, _loggerFactory.Object);
        }
コード例 #4
0
 private void GivenTheConfigKeyComesFromFileConfig(string key)
 {
     _fileConfiguration.GlobalConfiguration.ServiceDiscoveryProvider.ConfigurationKey = key;
     _repo = new ConsulFileConfigurationRepository(_options.Object, _cache.Object, _factory.Object, _loggerFactory.Object);
 }