@@ -19,15 +19,15 @@ class TestActions : IBuildActions
19
19
/// <summary>
20
20
/// List of strings passed to FileDelete.
21
21
/// </summary>
22
- public IList < string > FileDeleteIn = new List < string > ( ) ;
22
+ public readonly IList < string > FileDeleteIn = new List < string > ( ) ;
23
23
24
24
void IBuildActions . FileDelete ( string file )
25
25
{
26
26
FileDeleteIn . Add ( file ) ;
27
27
}
28
28
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 > ( ) ;
31
31
32
32
bool IBuildActions . FileExists ( string file )
33
33
{
@@ -39,10 +39,10 @@ bool IBuildActions.FileExists(string file)
39
39
throw new ArgumentException ( "Missing FileExists " + file ) ;
40
40
}
41
41
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 > ( ) ;
46
46
47
47
int IBuildActions . RunProcess ( string cmd , string args , string ? workingDirectory , IDictionary < string , string > ? env , out IList < string > stdOut )
48
48
{
@@ -72,14 +72,14 @@ int IBuildActions.RunProcess(string cmd, string args, string? workingDirectory,
72
72
throw new ArgumentException ( "Missing RunProcess " + pattern ) ;
73
73
}
74
74
75
- public IList < string > DirectoryDeleteIn = new List < string > ( ) ;
75
+ public readonly IList < string > DirectoryDeleteIn = new List < string > ( ) ;
76
76
77
77
void IBuildActions . DirectoryDelete ( string dir , bool recursive )
78
78
{
79
79
DirectoryDeleteIn . Add ( dir ) ;
80
80
}
81
81
82
- public IDictionary < string , bool > DirectoryExists = new Dictionary < string , bool > ( ) ;
82
+ public readonly IDictionary < string , bool > DirectoryExists = new Dictionary < string , bool > ( ) ;
83
83
84
84
bool IBuildActions . DirectoryExists ( string dir )
85
85
{
@@ -88,7 +88,7 @@ bool IBuildActions.DirectoryExists(string dir)
88
88
throw new ArgumentException ( "Missing DirectoryExists " + dir ) ;
89
89
}
90
90
91
- public IDictionary < string , string ? > GetEnvironmentVariable = new Dictionary < string , string ? > ( ) ;
91
+ public readonly IDictionary < string , string ? > GetEnvironmentVariable = new Dictionary < string , string ? > ( ) ;
92
92
93
93
string ? IBuildActions . GetEnvironmentVariable ( string name )
94
94
{
@@ -104,7 +104,7 @@ string IBuildActions.GetCurrentDirectory()
104
104
return GetCurrentDirectory ;
105
105
}
106
106
107
- public IDictionary < string , string > EnumerateFiles = new Dictionary < string , string > ( ) ;
107
+ public readonly IDictionary < string , string > EnumerateFiles = new Dictionary < string , string > ( ) ;
108
108
109
109
IEnumerable < string > IBuildActions . EnumerateFiles ( string dir )
110
110
{
@@ -113,7 +113,7 @@ IEnumerable<string> IBuildActions.EnumerateFiles(string dir)
113
113
throw new ArgumentException ( "Missing EnumerateFiles " + dir ) ;
114
114
}
115
115
116
- public IDictionary < string , string > EnumerateDirectories = new Dictionary < string , string > ( ) ;
116
+ public readonly IDictionary < string , string > EnumerateDirectories = new Dictionary < string , string > ( ) ;
117
117
118
118
IEnumerable < string > IBuildActions . EnumerateDirectories ( string dir )
119
119
{
@@ -137,7 +137,8 @@ void IBuildActions.WriteAllText(string filename, string contents)
137
137
{
138
138
}
139
139
140
- public IDictionary < string , XmlDocument > LoadXml = new Dictionary < string , XmlDocument > ( ) ;
140
+ public readonly IDictionary < string , XmlDocument > LoadXml = new Dictionary < string , XmlDocument > ( ) ;
141
+
141
142
XmlDocument IBuildActions . LoadXml ( string filename )
142
143
{
143
144
if ( LoadXml . TryGetValue ( filename , out var xml ) )
@@ -178,19 +179,19 @@ public TestSolution(string path)
178
179
179
180
public class BuildScriptTests
180
181
{
181
- TestActions Actions = new TestActions ( ) ;
182
+ readonly TestActions Actions = new TestActions ( ) ;
182
183
183
184
// Records the arguments passed to StartCallback.
184
- IList < string > StartCallbackIn = new List < string > ( ) ;
185
+ readonly IList < string > StartCallbackIn = new List < string > ( ) ;
185
186
186
187
void StartCallback ( string s , bool silent )
187
188
{
188
189
StartCallbackIn . Add ( s ) ;
189
190
}
190
191
191
192
// 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 > ( ) ;
194
195
195
196
void EndCallback ( int ret , string s , bool silent )
196
197
{
0 commit comments