Skip to content

Commit 0eee82b

Browse files
authored
Merge pull request #3342 from sharwell/use-tls
Set TLS defaults for testing
2 parents 6848e65 + f8aeb9d commit 0eee82b

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

StyleCop.Analyzers/StyleCop.Analyzers.Test/Verifiers/StyleCopCodeFixVerifier`2.cs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ namespace StyleCop.Analyzers.Test.Verifiers
77
using System.Collections.Generic;
88
using System.IO;
99
using System.Linq;
10+
using System.Net;
1011
using System.Threading;
1112
using System.Threading.Tasks;
1213
using global::LightJson;
@@ -91,6 +92,16 @@ internal class CSharpTest : CSharpCodeFixTest<TAnalyzer, TCodeFix, XUnitVerifier
9192
private const int DefaultTabSize = 4;
9293
private const bool DefaultUseTabs = false;
9394

95+
static CSharpTest()
96+
{
97+
// If we have outdated defaults from the host unit test application targeting an older .NET Framework,
98+
// use more reasonable TLS protocol version for outgoing connections.
99+
if (ServicePointManager.SecurityProtocol == (SecurityProtocolType.Ssl3 | SecurityProtocolType.Tls))
100+
{
101+
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
102+
}
103+
}
104+
94105
public CSharpTest()
95106
: this(languageVersion: null)
96107
{

0 commit comments

Comments
 (0)