Skip to content

Commit

Permalink
Merge pull request DotNetAnalyzers#3342 from sharwell/use-tls
Browse files Browse the repository at this point in the history
Set TLS defaults for testing
  • Loading branch information
sharwell authored Apr 28, 2021
2 parents 6848e65 + f8aeb9d commit 0eee82b
Showing 1 changed file with 11 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ namespace StyleCop.Analyzers.Test.Verifiers
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
using System.Threading;
using System.Threading.Tasks;
using global::LightJson;
Expand Down Expand Up @@ -91,6 +92,16 @@ internal class CSharpTest : CSharpCodeFixTest<TAnalyzer, TCodeFix, XUnitVerifier
private const int DefaultTabSize = 4;
private const bool DefaultUseTabs = false;

static CSharpTest()
{
// If we have outdated defaults from the host unit test application targeting an older .NET Framework,
// use more reasonable TLS protocol version for outgoing connections.
if (ServicePointManager.SecurityProtocol == (SecurityProtocolType.Ssl3 | SecurityProtocolType.Tls))
{
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
}
}

public CSharpTest()
: this(languageVersion: null)
{
Expand Down

0 comments on commit 0eee82b

Please sign in to comment.