Ejemplo n.º 1
0
        public AdminUserRepositoryShould()
        {
            // Given
            _dbLogger = new Mock <ILogger <GlownyShopContext> >();
            // https://docs.microsoft.com/en-us/ef/core/miscellaneous/testing/in-memory
            _options = new DbContextOptionsBuilder <GlownyShopContext>()
                       .UseInMemoryDatabase(databaseName: "GlownyShop_AdminUser")
                       .Options;
            using (var context = new GlownyShopContext(_options, _dbLogger.Object))
            {
                context.EnsureSeedData();
            }
            var glownyShopContext = new GlownyShopContext(_options, _dbLogger.Object);
            var repoLogger        = new Mock <ILogger <AdminUserRepository> >();

            _adminUserRepository = new AdminUserRepository(glownyShopContext, repoLogger.Object);
        }
Ejemplo n.º 2
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, GlownyShopContext db)
        {
            loggerFactory.AddConsole(Configuration.GetSection("Logging"));
            loggerFactory.AddDebug();

            app.UseCors(builder =>
                        builder.WithOrigins("http://localhost:3000")
                        .AllowAnyHeader()
                        .AllowAnyMethod()
                        .AllowCredentials()
                        );

            app.UseOAuthValidation();
            // Register the OpenIddict middleware.
            app.UseOpenIddict();
            app.UseMvcWithDefaultRoute();

            app.UseStaticFiles();
            app.UseMvc();

            db.EnsureSeedData();
        }