Skip to content

Commit 68eff11

Browse files
Fix Connection Strings for Tests (#529)
1 parent 46ab2ec commit 68eff11

File tree

1 file changed

+22
-18
lines changed

1 file changed

+22
-18
lines changed

src/Microsoft.Data.SqlClient/tests/ManualTests/DataCommon/DataTestUtility.cs

+22-18
Original file line numberDiff line numberDiff line change
@@ -52,24 +52,6 @@ public static class DataTestUtility
5252

5353
private static Dictionary<string, bool> AvailableDatabases;
5454
private static TraceEventListener TraceListener;
55-
public static IEnumerable<string> ConnectionStrings
56-
{
57-
get
58-
{
59-
if (!string.IsNullOrEmpty(TCPConnectionString))
60-
{
61-
yield return TCPConnectionString;
62-
}
63-
else if (!string.IsNullOrEmpty(NPConnectionString))
64-
{
65-
yield return NPConnectionString;
66-
}
67-
foreach (string connStrAE in AEConnStrings)
68-
{
69-
yield return connStrAE;
70-
}
71-
}
72-
}
7355

7456
private class Config
7557
{
@@ -174,6 +156,28 @@ static DataTestUtility()
174156
}
175157
}
176158

159+
public static IEnumerable<string> ConnectionStrings
160+
{
161+
get
162+
{
163+
if (!string.IsNullOrEmpty(TCPConnectionString))
164+
{
165+
yield return TCPConnectionString;
166+
}
167+
// Named Pipes are not supported on Unix platform and for Azure DB
168+
if (Environment.OSVersion.Platform != PlatformID.Unix && IsNotAzureServer() && !string.IsNullOrEmpty(NPConnectionString))
169+
{
170+
yield return NPConnectionString;
171+
}
172+
if (EnclaveEnabled)
173+
{
174+
foreach (var connStr in AEConnStrings)
175+
{
176+
yield return connStr;
177+
}
178+
}
179+
}
180+
}
177181
private static string GenerateAccessToken(string authorityURL, string aADAuthUserID, string aADAuthPassword)
178182
{
179183
return AcquireTokenAsync(authorityURL, aADAuthUserID, aADAuthPassword).Result;

0 commit comments

Comments
 (0)