// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IHostingEnvironment env) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } else { app.UseExceptionHandler("/Home/Error"); app.UseHsts(); } app.UseHttpsRedirection(); app.UseStaticFiles(); app.UseCookiePolicy(); app.UseAuthentication(); app.UseMvc(routes => { routes.MapRoute( name: "default", template: "{controller=Home}/{action=Index}/{id?}"); }); var dbMapping = new ConcurrentDictionary <string, string>(); dbMapping.GetOrAdd("Account", "Host=127.0.0.1;Username=postgres;Password=xuyan871206;Database=account;Pooling=true"); ConnectionStringInitializer.Init(dbMapping); }
public void CopyBoundSqlInstancesToWebConfigCopiesAnyBoundSqlServer() { var csi = new ConnectionStringInitializer(_config); csi.CopyBoundSqlInstancesToWebConfig(_webConfigWriter); _webConfigWriter.Received().SetConnectionString("schooldb", "Data Source=10.0.0.100,1433;Initial Catalog=school_prod;User Id=school_user;Password=secret;"); }
public void CopyBoundSqlInstancesToWebConfigThrowsWhenWebConfigWriterIsNull() { var csi = new ConnectionStringInitializer(_config); Assert.Throws <ArgumentNullException>(() => csi.CopyBoundSqlInstancesToWebConfig(null)); }