internal static void SetBaseUrl(Envirnoment testEnvironment = Envirnoment.SysTest) { string path = Directory.GetCurrentDirectory(); string newPath = Path.GetFullPath(Path.Combine(path, @"..\..\..\")); var config = new ConfigurationBuilder().AddJsonFile(System.IO.Path.Combine(newPath, "AppConfig.json")).Build(); if (testEnvironment == Envirnoment.SysTest) { URL = config["baseURLSysTest"]; testExecution = config["testExecution"]; } else if (testEnvironment == Envirnoment.Dev) { URL = config["baseURLDev"]; testExecution = config["testExecution"]; } else if (testEnvironment == Envirnoment.UAT) { URL = config["baseURLUAT"]; testExecution = config["testExecution"]; } else if (testEnvironment == Envirnoment.Staging) { URL = config["baseURLPreStaging"]; testExecution = config["testExecution"]; } }
public void Configure(IApplicationBuilder app, ILoggerFactory loggerFactory) { loggerFactory.AddConsole(Configuration.GetSection("Logging")); app.UseStatusCodePages(); if (Envirnoment.IsDevelopment()) { app.UseDeveloperExceptionPage(); } app.UseStaticFiles(); app.UseMvc(); }
public void ConfigureServices(IServiceCollection services) { if (Envirnoment.IsDevelopment()) { services.AddDbContext <TDLContext>(options => options.UseInMemoryDatabase()); services.AddTransient <IShowService, InMemoryShowService>(); } else { services.AddDbContext <TDLContext>(options => options.UseSqlite("Filename=./TDL.db")); services.AddTransient <IShowService, SqLiteShowService>(); } services.Configure <AppSettings>(options => Configuration.GetSection("AppSettings").Bind(options)); services .AddMvcCore() .AddViews() .AddRazorViewEngine() .AddRazorPages(); }
internal static void SetBaseUrl(Envirnoment testEnvironment = Envirnoment.SysTest) { var config = new ConfigurationBuilder() .AddJsonFile("AppConfig.json") .Build(); if (testEnvironment == Envirnoment.SysTest) { URL = config["baseURLSysTest"]; } else if (testEnvironment == Envirnoment.Dev) { URL = config["baseURLDev"]; } else if (testEnvironment == Envirnoment.UAT) { URL = config["baseURLUAT"]; } else if (testEnvironment == Envirnoment.Staging) { URL = config["baseURLPreStaging"]; } }
public static void SetBaseUrl(Envirnoment testEnvironment = Envirnoment.SysTest) { var config = new ConfigurationBuilder() .AddJsonFile("AppConfig.json") .Build(); if (testEnvironment == Envirnoment.SysTest) { Url = config["SysTest"]; } else if (testEnvironment == Envirnoment.Dev) { Url = config["Dev"]; } else if (testEnvironment == Envirnoment.UAT) { Url = config["UAT"]; } else if (testEnvironment == Envirnoment.Staging) { Url = config["Staging"]; } }
internal static void SetDBConnectionString(Envirnoment testEnvironment = Envirnoment.SysTest) { var config = new ConfigurationBuilder() .AddJsonFile("AppConfig.json") .Build(); if (testEnvironment == Envirnoment.SysTest) { DBConnectionStr = config["SysTestDB"]; } else if (testEnvironment == Envirnoment.Dev) { DBConnectionStr = config["DevDB"]; } else if (testEnvironment == Envirnoment.UAT) { DBConnectionStr = config["UATDB"]; } else if (testEnvironment == Envirnoment.Staging) { DBConnectionStr = config["StagingDB"]; } }
/// <summary> /// Set Envirnoment /// </summary> /// <param name="testEnviro">Envirnoment to test in</param> public static void setTestEnvirnoment(Envirnoment testEnviro) { _testEnvirnoment = testEnviro; }