Skip to content
Merged
Changes from 1 commit
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 @@ -4,13 +4,13 @@

using System.Collections.Generic;
using System.IO;
using System.Security.Authentication;
using Microsoft.SqlServer.TDS.PreLogin;

namespace Microsoft.Data.SqlClient.ManualTesting.Tests.DataCommon
{
public class ConnectionTestParametersData
{
private const int CASES = 30;
private string _empty = string.Empty;
// It was advised to store the client certificate in its own folder.
private static readonly string s_fullPathToCer = Path.Combine(Directory.GetCurrentDirectory(), "clientcert", "localhostcert.cer");
Expand All @@ -22,7 +22,7 @@ public class ConnectionTestParametersData

public static IEnumerable<object[]> GetConnectionTestParameters()
{
for (int i = 0; i < Data.ConnectionTestParametersList.Count; i++)
for (int i = 0; i < CASES; i++)
{
yield return new object[] { Data.ConnectionTestParametersList[i] };
}
Expand All @@ -33,11 +33,11 @@ public ConnectionTestParametersData()
// Test cases possible field values for connection parameters:
// These combinations are based on the possible values of Encrypt, TrustServerCertificate, Certificate, HostNameInCertificate
/*
* TDSEncryption | Encrypt | TrustServerCertificate | Certificate | HNIC | SSL Protocols | TestResults
* ---------------------------------------------------------------------------------------------------------------
* Off | Optional | true | valid | valid name | TLS 1.2 | true
* On | Mandatory | false | mismatched | empty | TLS 1.0, TLS 1.1 | false
* Required | | x | ChainError? | wrong name? | |
* TDSEncryption | Encrypt | TrustServerCertificate | Certificate | HNIC | TestResults
* ----------------------------------------------------------------------------------------------
* Off | Optional | true | valid | valid name | true
* On | Mandatory | false | mismatched | empty | false
* Required | | x | ChainError? | wrong name? |
*/
ConnectionTestParametersList = new List<ConnectionTestParameters>
{
Expand Down Expand Up @@ -79,21 +79,6 @@ public ConnectionTestParametersData()
new(TDSPreLoginTokenEncryptionType.On, SqlConnectionEncryptOption.Mandatory, true, s_mismatchedcert, _empty, true),
new(TDSPreLoginTokenEncryptionType.Required, SqlConnectionEncryptOption.Mandatory, false, s_mismatchedcert, _empty, false),
new(TDSPreLoginTokenEncryptionType.Required, SqlConnectionEncryptOption.Mandatory, true, s_mismatchedcert, _empty, true),

// Multiple SSL protocols test
#pragma warning disable CA5397 // Do not use deprecated SslProtocols values
#pragma warning disable CA5398 // Avoid hardcoded SslProtocols values
#if NET
#pragma warning disable SYSLIB0039 // Type or member is obsolete: TLS 1.0 & 1.1 are deprecated
#endif
new(TDSPreLoginTokenEncryptionType.Off, SqlConnectionEncryptOption.Mandatory, false, s_fullPathToCer, _empty, SslProtocols.Tls | SslProtocols.Tls11, true),
new(TDSPreLoginTokenEncryptionType.On, SqlConnectionEncryptOption.Mandatory, false, s_fullPathToCer, _empty, SslProtocols.Tls | SslProtocols.Tls11, true),
new(TDSPreLoginTokenEncryptionType.Required, SqlConnectionEncryptOption.Mandatory, false, s_fullPathToCer, _empty, SslProtocols.Tls | SslProtocols.Tls11, true),
#if NET
#pragma warning restore SYSLIB0039 // Type or member is obsolete: TLS 1.0 & 1.1 are deprecated
#endif
#pragma warning restore CA5397 // Do not use deprecated SslProtocols values
#pragma warning restore CA5398 // Avoid hardcoded SslProtocols values
};
}
}
Expand Down
Loading