-
Notifications
You must be signed in to change notification settings - Fork 286
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Also removed tests that compared error messages not owned by SqlClient.
- Loading branch information
1 parent
a947ded
commit 2134081
Showing
3 changed files
with
11 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -211,10 +211,7 @@ public static void ActiveDirectoryPasswordWithNoAuthType() | |
// connection fails with expected error message. | ||
string[] AuthKey = { "Authentication" }; | ||
string connStrWithNoAuthType = DataTestUtility.RemoveKeysInConnStr(DataTestUtility.AADPasswordConnectionString, AuthKey); | ||
SqlException e = Assert.Throws<SqlException>(() => ConnectAndDisconnect(connStrWithNoAuthType)); | ||
|
||
string expectedMessage = "Cannot open server \"microsoft.com\" requested by the login. The login failed."; | ||
Assert.Contains(expectedMessage, e.Message); | ||
Assert.Throws<SqlException>(() => ConnectAndDisconnect(connStrWithNoAuthType)); | ||
} | ||
|
||
[ConditionalFact(nameof(IsAADConnStringsSetup))] | ||
|
@@ -248,10 +245,7 @@ public static void EmptyPasswordInConnStrAADPassword() | |
// connection fails with expected error message. | ||
string[] pwdKey = { "Password", "PWD" }; | ||
string connStr = DataTestUtility.RemoveKeysInConnStr(DataTestUtility.AADPasswordConnectionString, pwdKey) + "Password=;"; | ||
AggregateException e = Assert.Throws<AggregateException>(() => ConnectAndDisconnect(connStr)); | ||
|
||
string expectedMessage = "ID3242: The security token could not be authenticated or authorized."; | ||
Assert.Contains(expectedMessage, e.InnerException.InnerException.InnerException.Message); | ||
Assert.Throws<AggregateException>(() => ConnectAndDisconnect(connStr)); | ||
} | ||
|
||
[PlatformSpecific(TestPlatforms.Windows)] | ||
|
@@ -261,11 +255,7 @@ public static void EmptyCredInConnStrAADPassword() | |
// connection fails with expected error message. | ||
string[] removeKeys = { "User ID", "Password", "UID", "PWD" }; | ||
string connStr = DataTestUtility.RemoveKeysInConnStr(DataTestUtility.AADPasswordConnectionString, removeKeys) + "User ID=; Password=;"; | ||
AggregateException e = Assert.Throws<AggregateException>(() => ConnectAndDisconnect(connStr)); | ||
|
||
string expectedMessage = "Failed to get user name"; | ||
|
||
Assert.Contains(expectedMessage, e.InnerException.InnerException.InnerException.Message); | ||
Assert.Throws<AggregateException>(() => ConnectAndDisconnect(connStr)); | ||
} | ||
|
||
[PlatformSpecific(TestPlatforms.AnyUnix)] | ||
|
@@ -275,11 +265,7 @@ public static void EmptyCredInConnStrAADPasswordAnyUnix() | |
// connection fails with expected error message. | ||
string[] removeKeys = { "User ID", "Password", "UID", "PWD" }; | ||
string connStr = DataTestUtility.RemoveKeysInConnStr(DataTestUtility.AADPasswordConnectionString, removeKeys) + "User ID=; Password=;"; | ||
AggregateException e = Assert.Throws<AggregateException>(() => ConnectAndDisconnect(connStr)); | ||
|
||
string expectedMessage = "cannot determine the username"; | ||
|
||
Assert.Contains(expectedMessage, e.InnerException.InnerException.InnerException.Message); | ||
Assert.Throws<AggregateException>(() => ConnectAndDisconnect(connStr)); | ||
} | ||
|
||
[ConditionalFact(nameof(IsAADConnStringsSetup))] | ||
|
@@ -288,10 +274,7 @@ public static void AADPasswordWithInvalidUser() | |
// connection fails with expected error message. | ||
string[] removeKeys = { "User ID", "UID" }; | ||
string connStr = DataTestUtility.RemoveKeysInConnStr(DataTestUtility.AADPasswordConnectionString, removeKeys) + "User [email protected]"; | ||
AggregateException e = Assert.Throws<AggregateException>(() => ConnectAndDisconnect(connStr)); | ||
|
||
string expectedMessage = "ID3242: The security token could not be authenticated or authorized."; | ||
Assert.Contains(expectedMessage, e.InnerException.InnerException.InnerException.Message); | ||
Assert.Throws<AggregateException>(() => ConnectAndDisconnect(connStr)); | ||
} | ||
|
||
[ConditionalFact(nameof(IsAADConnStringsSetup))] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters