Example #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, SchedulingDbContext schedulingDbContext)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }
            else
            {
                app.UseHttpsRedirection();
                app.UseHsts();
            }

            app.UseCors("AllowAll");

            schedulingDbContext.EnsureDbSeeded();

            app.UseSwagger();

            // Enable middleware to serve swagger-ui (HTML, JS, CSS, etc.),
            // specifying the Swagger JSON endpoint.
            app.UseSwaggerUI(c =>
            {
                c.SwaggerEndpoint("/swagger/v1/swagger.json", "My API V1");
            });

            app.UseMvc();
        }
        public void Init()
        {
            var options = new DbContextOptionsBuilder <SchedulingDbContext>()
                          .UseInMemoryDatabase(databaseName: "Scheduling_Context_Mock")
                          .Options;

            _schedulingDbContext = new SchedulingDbContext(options);

            _schedulingDbContext.EnsureDbSeeded();
            _placeRepository = new PlaceRepository(_schedulingDbContext);
        }