Support Boolean type for Encrypt option value (#1737)

This commit is contained in:
Cheena Malhotra
2022-10-27 14:32:22 -07:00
committed by GitHub
parent fef6330895
commit faaec187a7
2 changed files with 27 additions and 2 deletions

View File

@@ -673,6 +673,24 @@ namespace Microsoft.SqlTools.ServiceLayer.UnitTests.Connection
Assert.That(connectionString, Contains.Substring("Encrypt=" + expected.ToString()), "Encrypt not as expected.");
}
/// <summary>
/// Verify that Strict Encryption parameters can be built into a connection string for connecting.
/// </summary>
[Test]
[TestCase(true, "True")]
[TestCase(false, "False")]
public void ConnectingWithBoolEncryptBuildsConnectionString(bool encryptValue, string expected)
{
// Create a test connection details object and set the property to a specific value
ConnectionDetails details = TestObjects.GetTestConnectionDetails();
details.Options["encrypt"] = encryptValue;
// Test that a connection string can be created without exceptions
string connectionString = ConnectionService.BuildConnectionString(details);
Assert.That(connectionString, Contains.Substring("Encrypt=" + expected), "Encrypt not as expected.");
}
/// <summary>
/// Build connection string with an invalid property combinations
/// </summary>