Ejemplo n.º 1
0
        private void StartApi()
        {
            var mongoConfiguration  = new MongoConfiguration(_testMongoDb.ConnectionString, "Api");
            var tasksConfiguration  = new TasksConfiguration(TasksApiBaseUrl, TasksApiBehavior.ToHttpClient());
            var mailerConfiguration = new MailerConfiguration(FakeSmtpHost, 25);

            var builder = new WebHostBuilder()
                          .UseStartup <Startup>()
                          .ConfigureServices(configureServices =>
            {
                configureServices.AddSingleton(mongoConfiguration);
                configureServices.AddSingleton(tasksConfiguration);
                configureServices.AddSingleton(mailerConfiguration);
            });

            _server = new TestServer(builder);
            Handler = _server.CreateHandler();
        }