mirror of
https://github.com/actions/runner.git
synced 2026-01-03 00:17:49 +08:00
Fix IDE0090 (#2211)
This commit is contained in:
@@ -11,7 +11,7 @@ namespace GitHub.Runner.Common.Tests.Util
|
||||
[Trait("Category", "Common")]
|
||||
public void Equal_MatchesObjectEquality()
|
||||
{
|
||||
using (TestHostContext hc = new TestHostContext(this))
|
||||
using (TestHostContext hc = new(this))
|
||||
{
|
||||
Tracing trace = hc.GetTrace();
|
||||
|
||||
@@ -29,12 +29,12 @@ namespace GitHub.Runner.Common.Tests.Util
|
||||
[Trait("Category", "Common")]
|
||||
public void Equal_MatchesReferenceEquality()
|
||||
{
|
||||
using (TestHostContext hc = new TestHostContext(this))
|
||||
using (TestHostContext hc = new(this))
|
||||
{
|
||||
Tracing trace = hc.GetTrace();
|
||||
|
||||
// Arrange.
|
||||
object expected = new object();
|
||||
object expected = new();
|
||||
object actual = expected;
|
||||
|
||||
// Act/Assert.
|
||||
@@ -47,7 +47,7 @@ namespace GitHub.Runner.Common.Tests.Util
|
||||
[Trait("Category", "Common")]
|
||||
public void Equal_MatchesStructEquality()
|
||||
{
|
||||
using (TestHostContext hc = new TestHostContext(this))
|
||||
using (TestHostContext hc = new(this))
|
||||
{
|
||||
Tracing trace = hc.GetTrace();
|
||||
|
||||
@@ -65,12 +65,12 @@ namespace GitHub.Runner.Common.Tests.Util
|
||||
[Trait("Category", "Common")]
|
||||
public void Equal_ThrowsWhenActualObjectIsNull()
|
||||
{
|
||||
using (TestHostContext hc = new TestHostContext(this))
|
||||
using (TestHostContext hc = new(this))
|
||||
{
|
||||
Tracing trace = hc.GetTrace();
|
||||
|
||||
// Arrange.
|
||||
object expected = new object();
|
||||
object expected = new();
|
||||
object actual = null;
|
||||
|
||||
// Act/Assert.
|
||||
@@ -86,13 +86,13 @@ namespace GitHub.Runner.Common.Tests.Util
|
||||
[Trait("Category", "Common")]
|
||||
public void Equal_ThrowsWhenExpectedObjectIsNull()
|
||||
{
|
||||
using (TestHostContext hc = new TestHostContext(this))
|
||||
using (TestHostContext hc = new(this))
|
||||
{
|
||||
Tracing trace = hc.GetTrace();
|
||||
|
||||
// Arrange.
|
||||
object expected = null;
|
||||
object actual = new object();
|
||||
object actual = new();
|
||||
|
||||
// Act/Assert.
|
||||
Assert.Throws<ArgumentOutOfRangeException>(() =>
|
||||
@@ -107,13 +107,13 @@ namespace GitHub.Runner.Common.Tests.Util
|
||||
[Trait("Category", "Common")]
|
||||
public void Equal_ThrowsWhenObjectsAreNotEqual()
|
||||
{
|
||||
using (TestHostContext hc = new TestHostContext(this))
|
||||
using (TestHostContext hc = new(this))
|
||||
{
|
||||
Tracing trace = hc.GetTrace();
|
||||
|
||||
// Arrange.
|
||||
object expected = new object();
|
||||
object actual = new object();
|
||||
object expected = new();
|
||||
object actual = new();
|
||||
|
||||
// Act/Assert.
|
||||
Assert.Throws<ArgumentOutOfRangeException>(() =>
|
||||
@@ -128,7 +128,7 @@ namespace GitHub.Runner.Common.Tests.Util
|
||||
[Trait("Category", "Common")]
|
||||
public void Equal_ThrowsWhenStructsAreNotEqual()
|
||||
{
|
||||
using (TestHostContext hc = new TestHostContext(this))
|
||||
using (TestHostContext hc = new(this))
|
||||
{
|
||||
Tracing trace = hc.GetTrace();
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ namespace GitHub.Runner.Common.Tests.Util
|
||||
[Trait("Category", "Common")]
|
||||
public void Delete_DeletesDirectory()
|
||||
{
|
||||
using (TestHostContext hc = new TestHostContext(this))
|
||||
using (TestHostContext hc = new(this))
|
||||
{
|
||||
Tracing trace = hc.GetTrace();
|
||||
|
||||
@@ -49,7 +49,7 @@ namespace GitHub.Runner.Common.Tests.Util
|
||||
[Trait("Category", "Common")]
|
||||
public void Delete_DeletesFile()
|
||||
{
|
||||
using (TestHostContext hc = new TestHostContext(this))
|
||||
using (TestHostContext hc = new(this))
|
||||
{
|
||||
Tracing trace = hc.GetTrace();
|
||||
|
||||
@@ -83,7 +83,7 @@ namespace GitHub.Runner.Common.Tests.Util
|
||||
[Trait("Category", "Common")]
|
||||
public void DeleteDirectory_DeletesDirectoriesRecursively()
|
||||
{
|
||||
using (TestHostContext hc = new TestHostContext(this))
|
||||
using (TestHostContext hc = new(this))
|
||||
{
|
||||
Tracing trace = hc.GetTrace();
|
||||
|
||||
@@ -115,7 +115,7 @@ namespace GitHub.Runner.Common.Tests.Util
|
||||
[Trait("Category", "Common")]
|
||||
public async Task DeleteDirectory_DeletesDirectoryReparsePointChain()
|
||||
{
|
||||
using (TestHostContext hc = new TestHostContext(this))
|
||||
using (TestHostContext hc = new(this))
|
||||
{
|
||||
Tracing trace = hc.GetTrace();
|
||||
|
||||
@@ -179,7 +179,7 @@ namespace GitHub.Runner.Common.Tests.Util
|
||||
[Trait("Category", "Common")]
|
||||
public async Task DeleteDirectory_DeletesDirectoryReparsePointsBeforeDirectories()
|
||||
{
|
||||
using (TestHostContext hc = new TestHostContext(this))
|
||||
using (TestHostContext hc = new(this))
|
||||
{
|
||||
Tracing trace = hc.GetTrace();
|
||||
|
||||
@@ -230,7 +230,7 @@ namespace GitHub.Runner.Common.Tests.Util
|
||||
[Trait("Category", "Common")]
|
||||
public void DeleteDirectory_DeletesFilesRecursively()
|
||||
{
|
||||
using (TestHostContext hc = new TestHostContext(this))
|
||||
using (TestHostContext hc = new(this))
|
||||
{
|
||||
Tracing trace = hc.GetTrace();
|
||||
|
||||
@@ -264,7 +264,7 @@ namespace GitHub.Runner.Common.Tests.Util
|
||||
[Trait("Category", "Common")]
|
||||
public void DeleteDirectory_DeletesReadOnlyDirectories()
|
||||
{
|
||||
using (TestHostContext hc = new TestHostContext(this))
|
||||
using (TestHostContext hc = new(this))
|
||||
{
|
||||
Tracing trace = hc.GetTrace();
|
||||
|
||||
@@ -305,7 +305,7 @@ namespace GitHub.Runner.Common.Tests.Util
|
||||
[Trait("Category", "Common")]
|
||||
public void DeleteDirectory_DeletesReadOnlyRootDirectory()
|
||||
{
|
||||
using (TestHostContext hc = new TestHostContext(this))
|
||||
using (TestHostContext hc = new(this))
|
||||
{
|
||||
Tracing trace = hc.GetTrace();
|
||||
|
||||
@@ -341,7 +341,7 @@ namespace GitHub.Runner.Common.Tests.Util
|
||||
[Trait("Category", "Common")]
|
||||
public void DeleteDirectory_DeletesReadOnlyFiles()
|
||||
{
|
||||
using (TestHostContext hc = new TestHostContext(this))
|
||||
using (TestHostContext hc = new(this))
|
||||
{
|
||||
Tracing trace = hc.GetTrace();
|
||||
|
||||
@@ -381,7 +381,7 @@ namespace GitHub.Runner.Common.Tests.Util
|
||||
[Trait("Category", "Common")]
|
||||
public async Task DeleteDirectory_DoesNotFollowDirectoryReparsePoint()
|
||||
{
|
||||
using (TestHostContext hc = new TestHostContext(this))
|
||||
using (TestHostContext hc = new(this))
|
||||
{
|
||||
Tracing trace = hc.GetTrace();
|
||||
|
||||
@@ -428,7 +428,7 @@ namespace GitHub.Runner.Common.Tests.Util
|
||||
[Trait("Category", "Common")]
|
||||
public async Task DeleteDirectory_DoesNotFollowNestLevel1DirectoryReparsePoint()
|
||||
{
|
||||
using (TestHostContext hc = new TestHostContext(this))
|
||||
using (TestHostContext hc = new(this))
|
||||
{
|
||||
Tracing trace = hc.GetTrace();
|
||||
|
||||
@@ -477,7 +477,7 @@ namespace GitHub.Runner.Common.Tests.Util
|
||||
[Trait("Category", "Common")]
|
||||
public async Task DeleteDirectory_DoesNotFollowNestLevel2DirectoryReparsePoint()
|
||||
{
|
||||
using (TestHostContext hc = new TestHostContext(this))
|
||||
using (TestHostContext hc = new(this))
|
||||
{
|
||||
Tracing trace = hc.GetTrace();
|
||||
|
||||
@@ -528,7 +528,7 @@ namespace GitHub.Runner.Common.Tests.Util
|
||||
[Trait("Category", "Common")]
|
||||
public void DeleteDirectory_IgnoresFile()
|
||||
{
|
||||
using (TestHostContext hc = new TestHostContext(this))
|
||||
using (TestHostContext hc = new(this))
|
||||
{
|
||||
Tracing trace = hc.GetTrace();
|
||||
|
||||
@@ -563,7 +563,7 @@ namespace GitHub.Runner.Common.Tests.Util
|
||||
[Trait("Category", "Common")]
|
||||
public void DeleteFile_DeletesFile()
|
||||
{
|
||||
using (TestHostContext hc = new TestHostContext(this))
|
||||
using (TestHostContext hc = new(this))
|
||||
{
|
||||
Tracing trace = hc.GetTrace();
|
||||
|
||||
@@ -597,7 +597,7 @@ namespace GitHub.Runner.Common.Tests.Util
|
||||
[Trait("Category", "Common")]
|
||||
public void DeleteFile_DeletesReadOnlyFile()
|
||||
{
|
||||
using (TestHostContext hc = new TestHostContext(this))
|
||||
using (TestHostContext hc = new(this))
|
||||
{
|
||||
Tracing trace = hc.GetTrace();
|
||||
|
||||
@@ -637,7 +637,7 @@ namespace GitHub.Runner.Common.Tests.Util
|
||||
[Trait("Category", "Common")]
|
||||
public void DeleteFile_IgnoresDirectory()
|
||||
{
|
||||
using (TestHostContext hc = new TestHostContext(this))
|
||||
using (TestHostContext hc = new(this))
|
||||
{
|
||||
Tracing trace = hc.GetTrace();
|
||||
|
||||
@@ -670,7 +670,7 @@ namespace GitHub.Runner.Common.Tests.Util
|
||||
[Trait("Category", "Common")]
|
||||
public void GetRelativePath()
|
||||
{
|
||||
using (TestHostContext hc = new TestHostContext(this))
|
||||
using (TestHostContext hc = new(this))
|
||||
{
|
||||
Tracing trace = hc.GetTrace();
|
||||
|
||||
@@ -768,7 +768,7 @@ namespace GitHub.Runner.Common.Tests.Util
|
||||
[Trait("Category", "Common")]
|
||||
public void ResolvePath()
|
||||
{
|
||||
using (TestHostContext hc = new TestHostContext(this))
|
||||
using (TestHostContext hc = new(this))
|
||||
{
|
||||
Tracing trace = hc.GetTrace();
|
||||
|
||||
@@ -867,7 +867,7 @@ namespace GitHub.Runner.Common.Tests.Util
|
||||
[Trait("Category", "Common")]
|
||||
public void ValidateExecutePermission_DoesNotExceedFailsafe()
|
||||
{
|
||||
using (TestHostContext hc = new TestHostContext(this))
|
||||
using (TestHostContext hc = new(this))
|
||||
{
|
||||
Tracing trace = hc.GetTrace();
|
||||
|
||||
@@ -896,7 +896,7 @@ namespace GitHub.Runner.Common.Tests.Util
|
||||
[Trait("Category", "Common")]
|
||||
public void ValidateExecutePermission_ExceedsFailsafe()
|
||||
{
|
||||
using (TestHostContext hc = new TestHostContext(this))
|
||||
using (TestHostContext hc = new(this))
|
||||
{
|
||||
Tracing trace = hc.GetTrace();
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ namespace GitHub.Runner.Common.Tests.Util
|
||||
[Trait("Category", "Common")]
|
||||
public void FormatAlwaysCallsFormat()
|
||||
{
|
||||
using (TestHostContext hc = new TestHostContext(this))
|
||||
using (TestHostContext hc = new(this))
|
||||
{
|
||||
Tracing trace = hc.GetTrace();
|
||||
|
||||
@@ -48,7 +48,7 @@ namespace GitHub.Runner.Common.Tests.Util
|
||||
[Trait("Category", "Common")]
|
||||
public void FormatHandlesFormatException()
|
||||
{
|
||||
using (TestHostContext hc = new TestHostContext(this))
|
||||
using (TestHostContext hc = new(this))
|
||||
{
|
||||
Tracing trace = hc.GetTrace();
|
||||
|
||||
@@ -79,7 +79,7 @@ namespace GitHub.Runner.Common.Tests.Util
|
||||
[Trait("Category", "Common")]
|
||||
public void FormatUsesInvariantCulture()
|
||||
{
|
||||
using (TestHostContext hc = new TestHostContext(this))
|
||||
using (TestHostContext hc = new(this))
|
||||
{
|
||||
// Arrange.
|
||||
CultureInfo originalCulture = CultureInfo.CurrentCulture;
|
||||
@@ -105,7 +105,7 @@ namespace GitHub.Runner.Common.Tests.Util
|
||||
[Trait("Category", "Common")]
|
||||
public void ConvertNullOrEmptryStringToBool()
|
||||
{
|
||||
using (TestHostContext hc = new TestHostContext(this))
|
||||
using (TestHostContext hc = new(this))
|
||||
{
|
||||
// Arrange.
|
||||
string nullString = null;
|
||||
@@ -126,7 +126,7 @@ namespace GitHub.Runner.Common.Tests.Util
|
||||
[Trait("Category", "Common")]
|
||||
public void ConvertNullOrEmptryStringToDefaultBool()
|
||||
{
|
||||
using (TestHostContext hc = new TestHostContext(this))
|
||||
using (TestHostContext hc = new(this))
|
||||
{
|
||||
// Arrange.
|
||||
string nullString = null;
|
||||
@@ -147,7 +147,7 @@ namespace GitHub.Runner.Common.Tests.Util
|
||||
[Trait("Category", "Common")]
|
||||
public void ConvertStringToBool()
|
||||
{
|
||||
using (TestHostContext hc = new TestHostContext(this))
|
||||
using (TestHostContext hc = new(this))
|
||||
{
|
||||
// Arrange.
|
||||
string trueString1 = "1";
|
||||
|
||||
@@ -12,7 +12,7 @@ namespace GitHub.Runner.Common.Tests.Util
|
||||
public void TaskResultReturnCodeTranslate()
|
||||
{
|
||||
// Arrange.
|
||||
using (TestHostContext hc = new TestHostContext(this))
|
||||
using (TestHostContext hc = new(this))
|
||||
{
|
||||
// Act.
|
||||
TaskResult abandon = TaskResultUtil.TranslateFromReturnCode(TaskResultUtil.TranslateToReturnCode(TaskResult.Abandoned));
|
||||
@@ -57,7 +57,7 @@ namespace GitHub.Runner.Common.Tests.Util
|
||||
public void TaskResultsMerge()
|
||||
{
|
||||
// Arrange.
|
||||
using (TestHostContext hc = new TestHostContext(this))
|
||||
using (TestHostContext hc = new(this))
|
||||
{
|
||||
TaskResult merged;
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ namespace GitHub.Runner.Common.Tests.Util
|
||||
[Trait("Category", "Common")]
|
||||
public void VerifyOverwriteVssConnectionSetting()
|
||||
{
|
||||
using (TestHostContext hc = new TestHostContext(this))
|
||||
using (TestHostContext hc = new(this))
|
||||
{
|
||||
Tracing trace = hc.GetTrace();
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ namespace GitHub.Runner.Common.Tests.Util
|
||||
[Trait("Category", "Common")]
|
||||
public void UseWhichFindGit()
|
||||
{
|
||||
using (TestHostContext hc = new TestHostContext(this))
|
||||
using (TestHostContext hc = new(this))
|
||||
{
|
||||
//Arrange
|
||||
Tracing trace = hc.GetTrace();
|
||||
@@ -33,7 +33,7 @@ namespace GitHub.Runner.Common.Tests.Util
|
||||
[Trait("Category", "Common")]
|
||||
public void WhichReturnsNullWhenNotFound()
|
||||
{
|
||||
using (TestHostContext hc = new TestHostContext(this))
|
||||
using (TestHostContext hc = new(this))
|
||||
{
|
||||
//Arrange
|
||||
Tracing trace = hc.GetTrace();
|
||||
@@ -53,7 +53,7 @@ namespace GitHub.Runner.Common.Tests.Util
|
||||
[Trait("Category", "Common")]
|
||||
public void WhichThrowsWhenRequireAndNotFound()
|
||||
{
|
||||
using (TestHostContext hc = new TestHostContext(this))
|
||||
using (TestHostContext hc = new(this))
|
||||
{
|
||||
//Arrange
|
||||
Tracing trace = hc.GetTrace();
|
||||
@@ -76,7 +76,7 @@ namespace GitHub.Runner.Common.Tests.Util
|
||||
[Trait("Category", "Common")]
|
||||
public void WhichHandleFullyQualifiedPath()
|
||||
{
|
||||
using (TestHostContext hc = new TestHostContext(this))
|
||||
using (TestHostContext hc = new(this))
|
||||
{
|
||||
//Arrange
|
||||
Tracing trace = hc.GetTrace();
|
||||
|
||||
Reference in New Issue
Block a user