55using System . Collections . Generic ;
66using Microsoft . Build . BackEnd ;
77using Microsoft . Build . Framework ;
8- using Microsoft . Build . Framework . FileAccess ;
98using Microsoft . Build . Shared ;
109using Microsoft . Build . Utilities ;
1110using Xunit ;
@@ -26,67 +25,21 @@ public class TaskHostTaskComplete_Tests
2625 [ Fact ]
2726 public void TestConstructors ( )
2827 {
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 ) ;
7032
7133 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 ) ;
7835
7936 IDictionary < string , object > parameters2 = new Dictionary < string , object > ( ) ;
8037 parameters2 . Add ( "Text" , "Hello!" ) ;
8138 parameters2 . Add ( "MyBoolValue" , true ) ;
8239 parameters2 . Add ( "MyITaskItem" , new TaskItem ( "ABC" ) ) ;
8340 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 ) ;
9043 }
9144
9245 /// <summary>
@@ -107,12 +60,7 @@ public void TestInvalidConstructors()
10760 [ Fact ]
10861 public void TestTranslationWithNullDictionary ( )
10962 {
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 ) ;
11664
11765 ( ( ITranslatable ) complete ) . Translate ( TranslationHelpers . GetWriteTranslator ( ) ) ;
11866 INodePacket packet = TaskHostTaskComplete . FactoryForDeserialization ( TranslationHelpers . GetReadTranslator ( ) ) ;
@@ -130,12 +78,7 @@ public void TestTranslationWithNullDictionary()
13078 [ Fact ]
13179 public void TestTranslationWithEmptyDictionary ( )
13280 {
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 ) ;
13982
14083 ( ( ITranslatable ) complete ) . Translate ( TranslationHelpers . GetWriteTranslator ( ) ) ;
14184 INodePacket packet = TaskHostTaskComplete . FactoryForDeserialization ( TranslationHelpers . GetReadTranslator ( ) ) ;
@@ -156,12 +99,7 @@ public void TestTranslationWithValueTypesInDictionary()
15699 IDictionary < string , object > parameters = new Dictionary < string , object > ( ) ;
157100 parameters . Add ( "Text" , "Foo" ) ;
158101 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 ) ;
165103
166104 ( ( ITranslatable ) complete ) . Translate ( TranslationHelpers . GetWriteTranslator ( ) ) ;
167105 INodePacket packet = TaskHostTaskComplete . FactoryForDeserialization ( TranslationHelpers . GetReadTranslator ( ) ) ;
@@ -183,12 +121,7 @@ public void TestTranslationWithITaskItemInDictionary()
183121 {
184122 IDictionary < string , object > parameters = new Dictionary < string , object > ( ) ;
185123 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 ) ;
192125
193126 ( ( ITranslatable ) complete ) . Translate ( TranslationHelpers . GetWriteTranslator ( ) ) ;
194127 INodePacket packet = TaskHostTaskComplete . FactoryForDeserialization ( TranslationHelpers . GetReadTranslator ( ) ) ;
@@ -209,12 +142,7 @@ public void TestTranslationWithITaskItemArrayInDictionary()
209142 {
210143 IDictionary < string , object > parameters = new Dictionary < string , object > ( ) ;
211144 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 ) ;
218146
219147 ( ( ITranslatable ) complete ) . Translate ( TranslationHelpers . GetWriteTranslator ( ) ) ;
220148 INodePacket packet = TaskHostTaskComplete . FactoryForDeserialization ( TranslationHelpers . GetReadTranslator ( ) ) ;
@@ -240,12 +168,7 @@ private void AssertInvalidConstructorThrows(Type expectedExceptionType, TaskComp
240168
241169 try
242170 {
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 ) ;
249172 }
250173 catch ( Exception e )
251174 {
0 commit comments