Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1882,7 +1882,9 @@ private void DropHelperProcedures(string[] procNames)
sqlConnection.Open();
foreach (string name in procNames)
{
using (SqlCommand cmd = new SqlCommand(string.Format("IF EXISTS (SELECT * FROM sys.procedures WHERE name = '{0}') \n DROP PROCEDURE {0}", name), sqlConnection))
string procedureName = name.Trim( new Char[] { '[', ']'});

using (SqlCommand cmd = new SqlCommand(string.Format("IF EXISTS (SELECT * FROM sys.procedures WHERE name = '{0}') \n DROP PROCEDURE {0}", procedureName), sqlConnection))
{
cmd.ExecuteNonQuery();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ namespace Microsoft.Data.SqlClient.ManualTesting.Tests.AlwaysEncrypted
[PlatformSpecific(TestPlatforms.Windows)]
public class CspProviderExt
{
private string GenerateUniqueName(string baseName) => string.Concat("AE-", baseName, "-", Guid.NewGuid().ToString());

// [Fact(Skip="Run this in non-parallel mode")] or [ConditionalFact()]
[ConditionalFact(typeof(DataTestUtility), nameof(DataTestUtility.AreConnStringsSetup))]
public void TestKeysFromCertificatesCreatedWithMultipleCryptoProviders()
Expand Down Expand Up @@ -102,7 +100,8 @@ public void TestKeysFromCertificatesCreatedWithMultipleCryptoProviders()
finally
{
CertificateUtilityWin.RemoveCertificate(certificateName, StoreLocation.CurrentUser);
sqlSetupStrategyCsp?.DropTable();
// clean up database resources
sqlSetupStrategyCsp?.Dispose();
}

}
Expand Down Expand Up @@ -187,7 +186,8 @@ public void TestEncryptDecryptWithCSP()
}
finally
{
sqlSetupStrategyCsp.DropTable();
// clean up database resources
sqlSetupStrategyCsp.Dispose();
}
}
finally
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ namespace Microsoft.Data.SqlClient.ManualTesting.Tests.AlwaysEncrypted
{
public class SQLSetupStrategyCspExt : SQLSetupStrategy
{
//public string keyPath {get; private set;}
public Table CspProviderTable { get; private set; }
public SqlColumnEncryptionCspProvider keyStoreProvider { get; }

Expand All @@ -21,7 +20,7 @@ public SQLSetupStrategyCspExt(string cspKeyPath) : base(cspKeyPath)

internal override void SetupDatabase()
{
ColumnMasterKey columnMasterKey = new CspColumnMasterKey(GenerateUniqueName("CMK"), SqlColumnEncryptionCspProvider.ProviderName, keyPath);
ColumnMasterKey columnMasterKey = new CspColumnMasterKey(GenerateUniqueName("CspExt"), SqlColumnEncryptionCspProvider.ProviderName, keyPath);
databaseObjects.Add(columnMasterKey);

List<ColumnEncryptionKey> columnEncryptionKeys = CreateColumnEncryptionKeys(columnMasterKey, 2, keyStoreProvider);
Expand All @@ -43,14 +42,5 @@ private Table CreateTable(IList<ColumnEncryptionKey> columnEncryptionKeys)

return CspProviderTable;
}

public void DropTable()
{
using (SqlConnection sqlConnection = new SqlConnection(DataTestUtility.TcpConnStr))
{
sqlConnection.Open();
CspProviderTable.Drop(sqlConnection);
}
}
}
}