5
5
using System . Collections . Generic ;
6
6
using Microsoft . Build . BackEnd ;
7
7
using Microsoft . Build . Framework ;
8
- using Microsoft . Build . Framework . FileAccess ;
9
8
using Microsoft . Build . Shared ;
10
9
using Microsoft . Build . Utilities ;
11
10
using Xunit ;
@@ -26,67 +25,21 @@ public class TaskHostTaskComplete_Tests
26
25
[ Fact ]
27
26
public void TestConstructors ( )
28
27
{
29
- #if FEATURE_REPORTFILEACCESSES
30
- var fileAccessData = new List < FileAccessData > ( )
31
- {
32
- new FileAccessData (
33
- ReportedFileOperation . CreateFile ,
34
- RequestedAccess . Read ,
35
- 0 ,
36
- 0 ,
37
- DesiredAccess . GENERIC_READ ,
38
- FlagsAndAttributes . FILE_ATTRIBUTE_NORMAL ,
39
- "foo" ,
40
- null ,
41
- true ) ,
42
- } ;
43
- #endif
44
-
45
- _ = new TaskHostTaskComplete (
46
- new OutOfProcTaskHostTaskResult ( TaskCompleteType . Success ) ,
47
- #if FEATURE_REPORTFILEACCESSES
48
- fileAccessData ,
49
- #endif
50
- null) ;
51
- _ = new TaskHostTaskComplete (
52
- new OutOfProcTaskHostTaskResult ( TaskCompleteType . Failure ) ,
53
- #if FEATURE_REPORTFILEACCESSES
54
- fileAccessData ,
55
- #endif
56
- null) ;
57
- _ = new TaskHostTaskComplete (
58
- new OutOfProcTaskHostTaskResult ( TaskCompleteType . CrashedDuringInitialization ,
59
- new ArgumentOutOfRangeException ( ) ) ,
60
- #if FEATURE_REPORTFILEACCESSES
61
- fileAccessData ,
62
- #endif
63
- null) ;
64
- _ = new TaskHostTaskComplete (
65
- new OutOfProcTaskHostTaskResult ( TaskCompleteType . CrashedDuringExecution , new ArgumentNullException ( ) ) ,
66
- #if FEATURE_REPORTFILEACCESSES
67
- fileAccessData ,
68
- #endif
69
- null) ;
28
+ TaskHostTaskComplete complete = new TaskHostTaskComplete ( new OutOfProcTaskHostTaskResult ( TaskCompleteType . Success ) , null ) ;
29
+ TaskHostTaskComplete complete2 = new TaskHostTaskComplete ( new OutOfProcTaskHostTaskResult ( TaskCompleteType . Failure ) , null ) ;
30
+ TaskHostTaskComplete complete3 = new TaskHostTaskComplete ( new OutOfProcTaskHostTaskResult ( TaskCompleteType . CrashedDuringInitialization , new ArgumentOutOfRangeException ( ) ) , null ) ;
31
+ TaskHostTaskComplete complete4 = new TaskHostTaskComplete ( new OutOfProcTaskHostTaskResult ( TaskCompleteType . CrashedDuringExecution , new ArgumentNullException ( ) ) , null ) ;
70
32
71
33
IDictionary < string , object > parameters = new Dictionary < string , object > ( ) ;
72
- _ = new TaskHostTaskComplete (
73
- new OutOfProcTaskHostTaskResult ( TaskCompleteType . Success , parameters ) ,
74
- #if FEATURE_REPORTFILEACCESSES
75
- null ,
76
- #endif
77
- null) ;
34
+ TaskHostTaskComplete complete5 = new TaskHostTaskComplete ( new OutOfProcTaskHostTaskResult ( TaskCompleteType . Success , parameters ) , null ) ;
78
35
79
36
IDictionary < string , object > parameters2 = new Dictionary < string , object > ( ) ;
80
37
parameters2 . Add ( "Text" , "Hello!" ) ;
81
38
parameters2 . Add ( "MyBoolValue" , true ) ;
82
39
parameters2 . Add ( "MyITaskItem" , new TaskItem ( "ABC" ) ) ;
83
40
parameters2 . Add ( "ItemArray" , new ITaskItem [ ] { new TaskItem ( "DEF" ) , new TaskItem ( "GHI" ) , new TaskItem ( "JKL" ) } ) ;
84
- _ = new TaskHostTaskComplete (
85
- new OutOfProcTaskHostTaskResult ( TaskCompleteType . Success , parameters2 ) ,
86
- #if FEATURE_REPORTFILEACCESSES
87
- null ,
88
- #endif
89
- null) ;
41
+
42
+ TaskHostTaskComplete complete6 = new TaskHostTaskComplete ( new OutOfProcTaskHostTaskResult ( TaskCompleteType . Success , parameters2 ) , null ) ;
90
43
}
91
44
92
45
/// <summary>
@@ -107,12 +60,7 @@ public void TestInvalidConstructors()
107
60
[ Fact ]
108
61
public void TestTranslationWithNullDictionary ( )
109
62
{
110
- TaskHostTaskComplete complete = new (
111
- new OutOfProcTaskHostTaskResult ( TaskCompleteType . Success ) ,
112
- #if FEATURE_REPORTFILEACCESSES
113
- null ,
114
- #endif
115
- null) ;
63
+ TaskHostTaskComplete complete = new TaskHostTaskComplete ( new OutOfProcTaskHostTaskResult ( TaskCompleteType . Success ) , null ) ;
116
64
117
65
( ( ITranslatable ) complete ) . Translate ( TranslationHelpers . GetWriteTranslator ( ) ) ;
118
66
INodePacket packet = TaskHostTaskComplete . FactoryForDeserialization ( TranslationHelpers . GetReadTranslator ( ) ) ;
@@ -130,12 +78,7 @@ public void TestTranslationWithNullDictionary()
130
78
[ Fact ]
131
79
public void TestTranslationWithEmptyDictionary ( )
132
80
{
133
- TaskHostTaskComplete complete = new (
134
- new OutOfProcTaskHostTaskResult ( TaskCompleteType . Success , new Dictionary < string , object > ( ) ) ,
135
- #if FEATURE_REPORTFILEACCESSES
136
- null ,
137
- #endif
138
- null) ;
81
+ TaskHostTaskComplete complete = new TaskHostTaskComplete ( new OutOfProcTaskHostTaskResult ( TaskCompleteType . Success , new Dictionary < string , object > ( ) ) , null ) ;
139
82
140
83
( ( ITranslatable ) complete ) . Translate ( TranslationHelpers . GetWriteTranslator ( ) ) ;
141
84
INodePacket packet = TaskHostTaskComplete . FactoryForDeserialization ( TranslationHelpers . GetReadTranslator ( ) ) ;
@@ -156,12 +99,7 @@ public void TestTranslationWithValueTypesInDictionary()
156
99
IDictionary < string , object > parameters = new Dictionary < string , object > ( ) ;
157
100
parameters . Add ( "Text" , "Foo" ) ;
158
101
parameters . Add ( "BoolValue" , false ) ;
159
- TaskHostTaskComplete complete = new (
160
- new OutOfProcTaskHostTaskResult ( TaskCompleteType . Success , parameters ) ,
161
- #if FEATURE_REPORTFILEACCESSES
162
- null ,
163
- #endif
164
- null) ;
102
+ TaskHostTaskComplete complete = new TaskHostTaskComplete ( new OutOfProcTaskHostTaskResult ( TaskCompleteType . Success , parameters ) , null ) ;
165
103
166
104
( ( ITranslatable ) complete ) . Translate ( TranslationHelpers . GetWriteTranslator ( ) ) ;
167
105
INodePacket packet = TaskHostTaskComplete . FactoryForDeserialization ( TranslationHelpers . GetReadTranslator ( ) ) ;
@@ -183,12 +121,7 @@ public void TestTranslationWithITaskItemInDictionary()
183
121
{
184
122
IDictionary < string , object > parameters = new Dictionary < string , object > ( ) ;
185
123
parameters . Add ( "TaskItemValue" , new TaskItem ( "Foo" ) ) ;
186
- TaskHostTaskComplete complete = new (
187
- new OutOfProcTaskHostTaskResult ( TaskCompleteType . Success , parameters ) ,
188
- #if FEATURE_REPORTFILEACCESSES
189
- null ,
190
- #endif
191
- null) ;
124
+ TaskHostTaskComplete complete = new TaskHostTaskComplete ( new OutOfProcTaskHostTaskResult ( TaskCompleteType . Success , parameters ) , null ) ;
192
125
193
126
( ( ITranslatable ) complete ) . Translate ( TranslationHelpers . GetWriteTranslator ( ) ) ;
194
127
INodePacket packet = TaskHostTaskComplete . FactoryForDeserialization ( TranslationHelpers . GetReadTranslator ( ) ) ;
@@ -209,12 +142,7 @@ public void TestTranslationWithITaskItemArrayInDictionary()
209
142
{
210
143
IDictionary < string , object > parameters = new Dictionary < string , object > ( ) ;
211
144
parameters . Add ( "TaskItemArrayValue" , new ITaskItem [ ] { new TaskItem ( "Foo" ) , new TaskItem ( "Baz" ) } ) ;
212
- TaskHostTaskComplete complete = new (
213
- new OutOfProcTaskHostTaskResult ( TaskCompleteType . Success , parameters ) ,
214
- #if FEATURE_REPORTFILEACCESSES
215
- null ,
216
- #endif
217
- null) ;
145
+ TaskHostTaskComplete complete = new TaskHostTaskComplete ( new OutOfProcTaskHostTaskResult ( TaskCompleteType . Success , parameters ) , null ) ;
218
146
219
147
( ( ITranslatable ) complete ) . Translate ( TranslationHelpers . GetWriteTranslator ( ) ) ;
220
148
INodePacket packet = TaskHostTaskComplete . FactoryForDeserialization ( TranslationHelpers . GetReadTranslator ( ) ) ;
@@ -240,12 +168,7 @@ private void AssertInvalidConstructorThrows(Type expectedExceptionType, TaskComp
240
168
241
169
try
242
170
{
243
- TaskHostTaskComplete complete = new (
244
- new OutOfProcTaskHostTaskResult ( taskResult , taskOutputParameters , taskException , taskExceptionMessage , taskExceptionMessageArgs ) ,
245
- #if FEATURE_REPORTFILEACCESSES
246
- null ,
247
- #endif
248
- buildProcessEnvironment) ;
171
+ TaskHostTaskComplete complete = new TaskHostTaskComplete ( new OutOfProcTaskHostTaskResult ( taskResult , taskOutputParameters , taskException , taskExceptionMessage , taskExceptionMessageArgs ) , buildProcessEnvironment ) ;
249
172
}
250
173
catch ( Exception e )
251
174
{
0 commit comments