Exemplo n.º 1
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app,
                              IHostingEnvironment env,
                              ILoggerFactory loggerFactory,
                              ApiTestContext dbContext
                              )
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }

            loggerFactory.AddConsole(Configuration.GetSection("Logging"));
            loggerFactory.AddDebug();

            app.UseAuthentication();
            app.UseMvc();

            using (var serviceScope = app.ApplicationServices.GetRequiredService <IServiceScopeFactory>().CreateScope())
            {
                if (!serviceScope.ServiceProvider.GetService <ApiTestContext>().AllMigrationsApplied())
                {
                    serviceScope.ServiceProvider.GetService <ApiTestContext>().Database.Migrate();
                    serviceScope.ServiceProvider.GetService <ApiTestContext>().EnsureSeeded();
                }
            }

            dbContext.Database.EnsureCreated();
        }
Exemplo n.º 2
0
 public Conferences(ApiTestContext testContext)
 {
     _client = testContext.HttpClient;
 }
Exemplo n.º 3
0
 public Speakers(ApiTestContext testContext)
 {
     _client = testContext.HttpClient;
 }
Exemplo n.º 4
0
 public Communities(ApiTestContext testContext)
 {
     _client = testContext.HttpClient;
 }