Fix IDE0090 (#2211)

This commit is contained in:
Cory Miller
2022-10-18 10:54:08 -04:00
committed by GitHub
parent daba735b52
commit b87b4aac5c
99 changed files with 412 additions and 412 deletions

View File

@@ -63,7 +63,7 @@ namespace GitHub.Runner.Common.Tests
[Trait("Category", "Common")]
public async Task SuccessExitsWithCodeZero()
{
using (TestHostContext hc = new TestHostContext(this))
using (TestHostContext hc = new(this))
{
Tracing trace = hc.GetTrace();
@@ -86,7 +86,7 @@ namespace GitHub.Runner.Common.Tests
[Trait("Category", "Common")]
public async Task SetCIEnv()
{
using (TestHostContext hc = new TestHostContext(this))
using (TestHostContext hc = new(this))
{
var existingCI = Environment.GetEnvironmentVariable("CI");
try
@@ -134,7 +134,7 @@ namespace GitHub.Runner.Common.Tests
[Trait("Category", "Common")]
public async Task KeepExistingCIEnv()
{
using (TestHostContext hc = new TestHostContext(this))
using (TestHostContext hc = new(this))
{
var existingCI = Environment.GetEnvironmentVariable("CI");
try
@@ -185,7 +185,7 @@ namespace GitHub.Runner.Common.Tests
public async Task TestCancel()
{
const int SecondsToRun = 20;
using (TestHostContext hc = new TestHostContext(this))
using (TestHostContext hc = new(this))
using (var tokenSource = new CancellationTokenSource())
{
Tracing trace = hc.GetTrace();
@@ -234,13 +234,13 @@ namespace GitHub.Runner.Common.Tests
[Trait("Category", "Common")]
public async Task RedirectSTDINCloseStream()
{
using (TestHostContext hc = new TestHostContext(this))
using (TestHostContext hc = new(this))
{
Tracing trace = hc.GetTrace();
CancellationTokenSource cancellationTokenSource = new CancellationTokenSource();
CancellationTokenSource cancellationTokenSource = new();
Int32 exitCode = -1;
Channel<string> redirectSTDIN = Channel.CreateUnbounded<string>(new UnboundedChannelOptions() { SingleReader = true, SingleWriter = true });
List<string> stdout = new List<string>();
List<string> stdout = new();
redirectSTDIN.Writer.TryWrite("Single line of STDIN");
var processInvoker = new ProcessInvokerWrapper();
@@ -284,13 +284,13 @@ namespace GitHub.Runner.Common.Tests
[Trait("Category", "Common")]
public async Task RedirectSTDINKeepStreamOpen()
{
using (TestHostContext hc = new TestHostContext(this))
using (TestHostContext hc = new(this))
{
Tracing trace = hc.GetTrace();
CancellationTokenSource cancellationTokenSource = new CancellationTokenSource();
CancellationTokenSource cancellationTokenSource = new();
Int32 exitCode = -1;
Channel<string> redirectSTDIN = Channel.CreateUnbounded<string>(new UnboundedChannelOptions() { SingleReader = true, SingleWriter = true });
List<string> stdout = new List<string>();
List<string> stdout = new();
redirectSTDIN.Writer.TryWrite("Single line of STDIN");
var processInvoker = new ProcessInvokerWrapper();
@@ -339,7 +339,7 @@ namespace GitHub.Runner.Common.Tests
string testProcPath = $"/proc/{Process.GetCurrentProcess().Id}/oom_score_adj";
if (File.Exists(testProcPath))
{
using (TestHostContext hc = new TestHostContext(this))
using (TestHostContext hc = new(this))
using (var tokenSource = new CancellationTokenSource())
{
Tracing trace = hc.GetTrace();
@@ -375,7 +375,7 @@ namespace GitHub.Runner.Common.Tests
string testProcPath = $"/proc/{Process.GetCurrentProcess().Id}/oom_score_adj";
if (File.Exists(testProcPath))
{
using (TestHostContext hc = new TestHostContext(this))
using (TestHostContext hc = new(this))
using (var tokenSource = new CancellationTokenSource())
{
Tracing trace = hc.GetTrace();
@@ -415,7 +415,7 @@ namespace GitHub.Runner.Common.Tests
{
int testProcOomScoreAdj = 123;
File.WriteAllText(testProcPath, testProcOomScoreAdj.ToString());
using (TestHostContext hc = new TestHostContext(this))
using (TestHostContext hc = new(this))
using (var tokenSource = new CancellationTokenSource())
{
Tracing trace = hc.GetTrace();