From a2a938e964cfd1739b8b041212105944ded2ae47 Mon Sep 17 00:00:00 2001 From: xtqqczze <45661989+xtqqczze@users.noreply.github.com> Date: Fri, 30 Oct 2020 07:20:06 +0000 Subject: [PATCH] Fix IDE0044: MakeFieldReadonly part 10 (#13893) https://docs.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0044 --- test/xUnit/csharp/test_CommandLineParser.cs | 4 ++-- test/xUnit/csharp/test_FileSystemProvider.cs | 4 ++-- test/xUnit/csharp/test_PSConfiguration.cs | 2 +- test/xUnit/csharp/test_Runspace.cs | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/test/xUnit/csharp/test_CommandLineParser.cs b/test/xUnit/csharp/test_CommandLineParser.cs index 6644b5daef..2c44d9aa85 100644 --- a/test/xUnit/csharp/test_CommandLineParser.cs +++ b/test/xUnit/csharp/test_CommandLineParser.cs @@ -969,7 +969,7 @@ namespace PSTests.Parallel public class TestDataSettingsFile : IEnumerable { - private string _fileName = Path.GetTempFileName(); + private readonly string _fileName = Path.GetTempFileName(); public IEnumerator GetEnumerator() { @@ -1162,7 +1162,7 @@ namespace PSTests.Parallel public class TestDataLastFile : IEnumerable { - private string _fileName = Path.GetTempFileName(); + private readonly string _fileName = Path.GetTempFileName(); public IEnumerator GetEnumerator() { diff --git a/test/xUnit/csharp/test_FileSystemProvider.cs b/test/xUnit/csharp/test_FileSystemProvider.cs index 268dbddef4..ef702d47bd 100644 --- a/test/xUnit/csharp/test_FileSystemProvider.cs +++ b/test/xUnit/csharp/test_FileSystemProvider.cs @@ -24,8 +24,8 @@ namespace PSTests.Parallel { public class FileSystemProviderTests : IDisposable { - private string testPath; - private string testContent; + private readonly string testPath; + private readonly string testContent; public FileSystemProviderTests() { diff --git a/test/xUnit/csharp/test_PSConfiguration.cs b/test/xUnit/csharp/test_PSConfiguration.cs index 9555071375..6237f45333 100644 --- a/test/xUnit/csharp/test_PSConfiguration.cs +++ b/test/xUnit/csharp/test_PSConfiguration.cs @@ -376,7 +376,7 @@ namespace PSTests.Sequential public class PowerShellPolicyTests : IClassFixture { - private PowerShellPolicyFixture fixture; + private readonly PowerShellPolicyFixture fixture; public PowerShellPolicyTests(PowerShellPolicyFixture fixture) { diff --git a/test/xUnit/csharp/test_Runspace.cs b/test/xUnit/csharp/test_Runspace.cs index 3a7a6278bf..bd8afb5746 100644 --- a/test/xUnit/csharp/test_Runspace.cs +++ b/test/xUnit/csharp/test_Runspace.cs @@ -13,8 +13,8 @@ namespace PSTests.Sequential // otherwise Invoke will not return any objects public class RunspaceTests { - private static int count = 1; - private static string script = string.Format($"get-command get-command"); + private static readonly int count = 1; + private static readonly string script = string.Format($"get-command get-command"); [Fact] public void TestRunspaceWithPipeline()