Ejemplo n.º 1
0
        private string GetConnectionStringByName(string connectionStringName)
        {
            string connectionString = Environment.GetEnvironmentVariable(connectionStringName)
                                      ?? GetParameter(connectionStringName)
                                      ?? Configuration.GetConnectionString(connectionStringName);

            if (string.IsNullOrWhiteSpace(connectionString))
            {
                TestFramework.Fail($@"Cannot find connection string.  Looked in EnvironmentVariables ('{connectionStringName}'), TestContext ('{connectionStringName}' property) and appsettings.json ('{connectionStringName}' connection string)");
            }
            return(connectionString);
        }