public ContainerFixture() { var configuration = ConfigurationHelper.GetConfigurationFromFile(ConfigFile); var config = new Config(configuration); var services = new ServiceCollection(); _logger = new LoggerConfiguration() .ReadFrom.Configuration(configuration) .CreateLogger(); services.AddLogging(loggingBuilder => loggingBuilder.AddSerilog(logger: _logger, dispose: false)); services.AddILogger(); services.AddApplicationContext(); AddServices(services, configuration); var container = new ComponentModelContainer(services).InitializeFromConfig(configuration); container.RegisterInstance(configuration); container.RegisterInstance(config); AddToContainer(container, configuration); container.CreateContainer(); Container = container; }
// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { services.AddControllers(); var config = new Config(Configuration); var container = new ComponentModelContainer(services).InitializeFromConfig(Configuration); container.RegisterInstance(config); RootingTopology.Configure(Configuration); services.AddSwaggerGen(); }