Skip to content

Commit d8722b6

Browse files
committed
Add high-level summary to cryptographic fixtures
1 parent 3aa4e18 commit d8722b6

File tree

5 files changed

+44
-0
lines changed

5 files changed

+44
-0
lines changed

src/Microsoft.Data.SqlClient/tests/Common/Fixtures/AzureKeyVaultKeyFixtureBase.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,14 @@
99

1010
namespace Microsoft.Data.SqlClient.Tests.Common.Fixtures;
1111

12+
/// <summary>
13+
/// Provides a base class for managing Azure Key Vault keys in test fixtures.
14+
/// </summary>
15+
/// <remarks>
16+
/// This class simplifies the creation and cleanup of RSA keys in an Azure Key Vault during testing
17+
/// scenarios. It ensures that any keys created during the fixture's lifetime are properly deleted when the fixture is
18+
/// disposed.
19+
/// </remarks>
1220
public abstract class AzureKeyVaultKeyFixtureBase : IDisposable
1321
{
1422
private readonly KeyClient _keyClient;

src/Microsoft.Data.SqlClient/tests/Common/Fixtures/CertificateFixtureBase.cs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,19 @@
1212

1313
namespace Microsoft.Data.SqlClient.Tests.Common.Fixtures;
1414

15+
/// <summary>
16+
/// Provides a base class for managing the creation, storage, and disposal of X.509 certificates used in cryptographic
17+
/// operations. This class is designed to facilitate scenarios where certificates need to be programmatically generated,
18+
/// added to certificate stores, and cleaned up after use.
19+
/// </summary>
20+
/// <remarks>
21+
/// This class includes functionality for creating self-signed certificates with specific configurations,
22+
/// adding certificates to system certificate stores, and ensuring proper cleanup of certificates to avoid resource
23+
/// leaks. It is intended to be used as a base class for test fixtures or other scenarios requiring temporary
24+
/// certificate management.
25+
/// <para>The class implements <see cref="IDisposable"/> to ensure that any certificates added to
26+
/// certificate stores are removed and properly disposed of when the object is no longer needed.</para>
27+
/// </remarks>
1528
public abstract class CertificateFixtureBase : IDisposable
1629
{
1730
/// <summary>

src/Microsoft.Data.SqlClient/tests/Common/Fixtures/ColumnEncryptionCertificateFixture.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,14 @@
88

99
namespace Microsoft.Data.SqlClient.Tests.Common.Fixtures;
1010

11+
/// <summary>
12+
/// Provides a fixture for managing certificates used in column encryption scenarios.
13+
/// </summary>
14+
/// <remarks>
15+
/// This class creates and manages certificates for testing or operational purposes, including primary
16+
/// and secondary column encryption certificates, as well as a certificate without a private key. Certificates are
17+
/// added to the appropriate certificate stores based on the current user's permissions.
18+
/// </remarks>
1119
public sealed class ColumnEncryptionCertificateFixture : CertificateFixtureBase
1220
{
1321
public X509Certificate2 PrimaryColumnEncryptionCertificate { get; }

src/Microsoft.Data.SqlClient/tests/Common/Fixtures/ColumnMasterKeyCertificateFixture.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,13 @@
77

88
namespace Microsoft.Data.SqlClient.Tests.Common.Fixtures;
99

10+
/// <summary>
11+
/// Provides a test fixture for managing a column master key certificate.
12+
/// </summary>
13+
/// <remarks>
14+
/// This class is intended to simplify the setup and teardown of a column master key certificate for
15+
/// testing purposes. It creates and optionally adds the certificate to the specified certificate store.
16+
/// </remarks>
1017
public class ColumnMasterKeyCertificateFixture : CertificateFixtureBase
1118
{
1219
public ColumnMasterKeyCertificateFixture()

src/Microsoft.Data.SqlClient/tests/Common/Fixtures/CspCertificateFixture.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,14 @@
88

99
namespace Microsoft.Data.SqlClient.Tests.Common.Fixtures;
1010

11+
/// <summary>
12+
/// Provides a fixture for working with certificates backed by a Cryptographic Service Provider (CSP).
13+
/// </summary>
14+
/// <remarks>
15+
/// This class creates and manages a certificate stored in the current user's certificate store, along
16+
/// with its associated CSP key path. It is intended to facilitate testing or scenarios requiring temporary
17+
/// certificates.
18+
/// </remarks>
1119
public class CspCertificateFixture : CertificateFixtureBase
1220
{
1321
public CspCertificateFixture()

0 commit comments

Comments
 (0)