Ejemplo n.º 1
0
        public VehicleFixture()
        {
            var builder = new DbContextOptionsBuilder <VehicleMutationsDbContext>()
                          .UseInMemoryDatabase(databaseName: Guid.NewGuid().ToString())
                          .EnableSensitiveDataLogging()
                          .EnableDetailedErrors();
            var mutationsDbContext = new VehicleMutationsDbContext(builder.Options);

            MutationsHandler = new VehicleMutationsHandler(mutationsDbContext);

            VehicleStartup.Configure(
                secret: string.Empty,
                pathFiles: string.Empty
                );
        }
Ejemplo n.º 2
0
        public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
        {
            Environment = env.EnvironmentName;
            VehicleStartup.Configure(
                secret: Configuration.GetValue <string>("Secret"),
                pathFiles: Path.Combine(env.ContentRootPath, Configuration.GetValue <string>("PathFiles"))
                );
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }
            else
            {
                app.UseHsts();
            }

            app.UseCors("AllowOrigin");
            app.UseRouting();

            app.UseAuthentication();
            app.UseAuthorization();

            app.UseEndpoints(endpoints =>
            {
                endpoints.MapControllers();
                endpoints.MapDefaultControllerRoute();
            });

            app.UseSwagger();
            app.UseSwaggerUI(c =>
            {
                c.SwaggerEndpoint("/swagger/v1/swagger.json", "Questor Vehicle API");
                c.RoutePrefix = string.Empty;
            });
            app.UseHttpsRedirection();
        }