@@ -19,15 +19,15 @@ class TestActions : IBuildActions
1919 /// <summary>
2020 /// List of strings passed to FileDelete.
2121 /// </summary>
22- public IList < string > FileDeleteIn = new List < string > ( ) ;
22+ public readonly IList < string > FileDeleteIn = new List < string > ( ) ;
2323
2424 void IBuildActions . FileDelete ( string file )
2525 {
2626 FileDeleteIn . Add ( file ) ;
2727 }
2828
29- public IList < string > FileExistsIn = new List < string > ( ) ;
30- public IDictionary < string , bool > FileExists = new Dictionary < string , bool > ( ) ;
29+ public readonly IList < string > FileExistsIn = new List < string > ( ) ;
30+ public readonly IDictionary < string , bool > FileExists = new Dictionary < string , bool > ( ) ;
3131
3232 bool IBuildActions . FileExists ( string file )
3333 {
@@ -39,10 +39,10 @@ bool IBuildActions.FileExists(string file)
3939 throw new ArgumentException ( "Missing FileExists " + file ) ;
4040 }
4141
42- public IList < string > RunProcessIn = new List < string > ( ) ;
43- public IDictionary < string , int > RunProcess = new Dictionary < string , int > ( ) ;
44- public IDictionary < string , string > RunProcessOut = new Dictionary < string , string > ( ) ;
45- public IDictionary < string , string > RunProcessWorkingDirectory = new Dictionary < string , string > ( ) ;
42+ public readonly IList < string > RunProcessIn = new List < string > ( ) ;
43+ public readonly IDictionary < string , int > RunProcess = new Dictionary < string , int > ( ) ;
44+ public readonly IDictionary < string , string > RunProcessOut = new Dictionary < string , string > ( ) ;
45+ public readonly IDictionary < string , string > RunProcessWorkingDirectory = new Dictionary < string , string > ( ) ;
4646
4747 int IBuildActions . RunProcess ( string cmd , string args , string ? workingDirectory , IDictionary < string , string > ? env , out IList < string > stdOut )
4848 {
@@ -72,14 +72,14 @@ int IBuildActions.RunProcess(string cmd, string args, string? workingDirectory,
7272 throw new ArgumentException ( "Missing RunProcess " + pattern ) ;
7373 }
7474
75- public IList < string > DirectoryDeleteIn = new List < string > ( ) ;
75+ public readonly IList < string > DirectoryDeleteIn = new List < string > ( ) ;
7676
7777 void IBuildActions . DirectoryDelete ( string dir , bool recursive )
7878 {
7979 DirectoryDeleteIn . Add ( dir ) ;
8080 }
8181
82- public IDictionary < string , bool > DirectoryExists = new Dictionary < string , bool > ( ) ;
82+ public readonly IDictionary < string , bool > DirectoryExists = new Dictionary < string , bool > ( ) ;
8383
8484 bool IBuildActions . DirectoryExists ( string dir )
8585 {
@@ -88,7 +88,7 @@ bool IBuildActions.DirectoryExists(string dir)
8888 throw new ArgumentException ( "Missing DirectoryExists " + dir ) ;
8989 }
9090
91- public IDictionary < string , string ? > GetEnvironmentVariable = new Dictionary < string , string ? > ( ) ;
91+ public readonly IDictionary < string , string ? > GetEnvironmentVariable = new Dictionary < string , string ? > ( ) ;
9292
9393 string ? IBuildActions . GetEnvironmentVariable ( string name )
9494 {
@@ -104,7 +104,7 @@ string IBuildActions.GetCurrentDirectory()
104104 return GetCurrentDirectory ;
105105 }
106106
107- public IDictionary < string , string > EnumerateFiles = new Dictionary < string , string > ( ) ;
107+ public readonly IDictionary < string , string > EnumerateFiles = new Dictionary < string , string > ( ) ;
108108
109109 IEnumerable < string > IBuildActions . EnumerateFiles ( string dir )
110110 {
@@ -113,7 +113,7 @@ IEnumerable<string> IBuildActions.EnumerateFiles(string dir)
113113 throw new ArgumentException ( "Missing EnumerateFiles " + dir ) ;
114114 }
115115
116- public IDictionary < string , string > EnumerateDirectories = new Dictionary < string , string > ( ) ;
116+ public readonly IDictionary < string , string > EnumerateDirectories = new Dictionary < string , string > ( ) ;
117117
118118 IEnumerable < string > IBuildActions . EnumerateDirectories ( string dir )
119119 {
@@ -137,7 +137,8 @@ void IBuildActions.WriteAllText(string filename, string contents)
137137 {
138138 }
139139
140- public IDictionary < string , XmlDocument > LoadXml = new Dictionary < string , XmlDocument > ( ) ;
140+ public readonly IDictionary < string , XmlDocument > LoadXml = new Dictionary < string , XmlDocument > ( ) ;
141+
141142 XmlDocument IBuildActions . LoadXml ( string filename )
142143 {
143144 if ( LoadXml . TryGetValue ( filename , out var xml ) )
@@ -178,19 +179,19 @@ public TestSolution(string path)
178179
179180 public class BuildScriptTests
180181 {
181- TestActions Actions = new TestActions ( ) ;
182+ readonly TestActions Actions = new TestActions ( ) ;
182183
183184 // Records the arguments passed to StartCallback.
184- IList < string > StartCallbackIn = new List < string > ( ) ;
185+ readonly IList < string > StartCallbackIn = new List < string > ( ) ;
185186
186187 void StartCallback ( string s , bool silent )
187188 {
188189 StartCallbackIn . Add ( s ) ;
189190 }
190191
191192 // Records the arguments passed to EndCallback
192- IList < string > EndCallbackIn = new List < string > ( ) ;
193- IList < int > EndCallbackReturn = new List < int > ( ) ;
193+ readonly IList < string > EndCallbackIn = new List < string > ( ) ;
194+ readonly IList < int > EndCallbackReturn = new List < int > ( ) ;
194195
195196 void EndCallback ( int ret , string s , bool silent )
196197 {
0 commit comments