public static IServiceCollection ConfigureServices(this IServiceCollection serviceCollection, IConfiguration configuration)
        {
            serviceCollection.AddLogging(configure => configure.AddConsole());

            serviceCollection.AddTransient <NativeProxyApplication>();

            var appConfig = new CloudProxyApplicationConfiguration();

            configuration.Bind(appConfig);
            serviceCollection.AddSingleton <IAppConfiguration>(appConfig);

            var queueConfig = RabbitMqDefaultConfigLoader.SetDefaults(new RabbitMqQueueConfiguration());

            configuration.Bind(queueConfig);
            serviceCollection.AddSingleton <IQueueConfiguration>(queueConfig);

            var storeConfig = AdaptationStoreConfigLoader.SetDefaults(new AdaptationStoreConfiguration());

            configuration.Bind(storeConfig);
            serviceCollection.AddSingleton <IStoreConfiguration>(storeConfig);

            var processingConfig = IcapProcessingConfigLoader.SetDefaults(new IcapProcessingConfiguration());

            configuration.Bind(processingConfig);
            serviceCollection.AddSingleton <IProcessingConfiguration>(processingConfig);

            serviceCollection.AddTransient(typeof(IAdaptationServiceClient <>), typeof(RabbitMqClient <>));
            serviceCollection.AddTransient <IResponseProcessor, AdaptationOutcomeProcessor>();

            return(serviceCollection);
        }
Exemplo n.º 2
0
        public static IServiceCollection ConfigureServices(this IServiceCollection serviceCollection, IConfiguration configuration)
        {
            IQueueConfiguration queueConfig = RabbitMqDefaultConfigLoader.SetDefaults(new RabbitMqQueueConfiguration());

            configuration.Bind(queueConfig);
            serviceCollection.AddTransient <IQueueConfiguration>(x => queueConfig);

            IStoreConfiguration storeConfig = AdaptationStoreConfigLoader.SetDefaults(new AdaptationStoreConfiguration());

            configuration.Bind(storeConfig);
            serviceCollection.AddTransient <IStoreConfiguration>(x => storeConfig);

            IProcessingConfiguration processingConfig = IcapProcessingConfigLoader.SetDefaults(new IcapProcessingConfiguration());

            configuration.Bind(processingConfig);
            serviceCollection.AddTransient <IProcessingConfiguration>(x => processingConfig);

            ICloudSdkConfiguration versionConfiguration = CloudSdkConfigLoader.SetDefaults(new CloudSdkConfiguration());

            configuration.Bind(versionConfiguration);
            serviceCollection.AddTransient <ICloudSdkConfiguration>(x => versionConfiguration);

            serviceCollection.AddTransient(typeof(IAdaptationServiceClient <>), typeof(RabbitMqClient <>));
            serviceCollection.AddTransient <IResponseProcessor, AdaptationOutcomeProcessor>();
            serviceCollection.AddTransient <IHttpService, HttpService.HttpService>();
            serviceCollection.AddSingleton <IRabbitMqConnectionFactory, RabbitMqConnectionFactory>();

            return(serviceCollection);
        }
Exemplo n.º 3
0
        public void CreateQueueConfiguration()
        {
            var mockConfiguration = new Mock <IStoreConfiguration>();

            mockConfiguration.SetupAllProperties();

            defaultedConfiguration = AdaptationStoreConfigLoader.SetDefaults(mockConfiguration.Object);
        }