55using System . Collections . Generic ;
66using Microsoft . Build . BackEnd ;
77using Microsoft . Build . Framework ;
8+ using Microsoft . Build . Framework . FileAccess ;
89using Microsoft . Build . Shared ;
910using Microsoft . Build . Utilities ;
1011using Xunit ;
@@ -25,21 +26,67 @@ public class TaskHostTaskComplete_Tests
2526 [ Fact ]
2627 public void TestConstructors ( )
2728 {
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 ) ;
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) ;
3270
3371 IDictionary < string , object > parameters = new Dictionary < string , object > ( ) ;
34- TaskHostTaskComplete complete5 = new TaskHostTaskComplete ( new OutOfProcTaskHostTaskResult ( TaskCompleteType . Success , parameters ) , null ) ;
72+ _ = new TaskHostTaskComplete (
73+ new OutOfProcTaskHostTaskResult ( TaskCompleteType . Success , parameters ) ,
74+ #if FEATURE_REPORTFILEACCESSES
75+ null ,
76+ #endif
77+ null) ;
3578
3679 IDictionary < string , object > parameters2 = new Dictionary < string , object > ( ) ;
3780 parameters2 . Add ( "Text" , "Hello!" ) ;
3881 parameters2 . Add ( "MyBoolValue" , true ) ;
3982 parameters2 . Add ( "MyITaskItem" , new TaskItem ( "ABC" ) ) ;
4083 parameters2 . Add ( "ItemArray" , new ITaskItem [ ] { new TaskItem ( "DEF" ) , new TaskItem ( "GHI" ) , new TaskItem ( "JKL" ) } ) ;
41-
42- TaskHostTaskComplete complete6 = new TaskHostTaskComplete ( new OutOfProcTaskHostTaskResult ( TaskCompleteType . Success , parameters2 ) , null ) ;
84+ _ = new TaskHostTaskComplete (
85+ new OutOfProcTaskHostTaskResult ( TaskCompleteType . Success , parameters2 ) ,
86+ #if FEATURE_REPORTFILEACCESSES
87+ null ,
88+ #endif
89+ null) ;
4390 }
4491
4592 /// <summary>
@@ -60,7 +107,12 @@ public void TestInvalidConstructors()
60107 [ Fact ]
61108 public void TestTranslationWithNullDictionary ( )
62109 {
63- TaskHostTaskComplete complete = new TaskHostTaskComplete ( new OutOfProcTaskHostTaskResult ( TaskCompleteType . Success ) , null ) ;
110+ TaskHostTaskComplete complete = new (
111+ new OutOfProcTaskHostTaskResult ( TaskCompleteType . Success ) ,
112+ #if FEATURE_REPORTFILEACCESSES
113+ null ,
114+ #endif
115+ null) ;
64116
65117 ( ( ITranslatable ) complete ) . Translate ( TranslationHelpers . GetWriteTranslator ( ) ) ;
66118 INodePacket packet = TaskHostTaskComplete . FactoryForDeserialization ( TranslationHelpers . GetReadTranslator ( ) ) ;
@@ -78,7 +130,12 @@ public void TestTranslationWithNullDictionary()
78130 [ Fact ]
79131 public void TestTranslationWithEmptyDictionary ( )
80132 {
81- TaskHostTaskComplete complete = new TaskHostTaskComplete ( new OutOfProcTaskHostTaskResult ( TaskCompleteType . Success , new Dictionary < string , object > ( ) ) , null ) ;
133+ TaskHostTaskComplete complete = new (
134+ new OutOfProcTaskHostTaskResult ( TaskCompleteType . Success , new Dictionary < string , object > ( ) ) ,
135+ #if FEATURE_REPORTFILEACCESSES
136+ null ,
137+ #endif
138+ null) ;
82139
83140 ( ( ITranslatable ) complete ) . Translate ( TranslationHelpers . GetWriteTranslator ( ) ) ;
84141 INodePacket packet = TaskHostTaskComplete . FactoryForDeserialization ( TranslationHelpers . GetReadTranslator ( ) ) ;
@@ -99,7 +156,12 @@ public void TestTranslationWithValueTypesInDictionary()
99156 IDictionary < string , object > parameters = new Dictionary < string , object > ( ) ;
100157 parameters . Add ( "Text" , "Foo" ) ;
101158 parameters . Add ( "BoolValue" , false ) ;
102- TaskHostTaskComplete complete = new TaskHostTaskComplete ( new OutOfProcTaskHostTaskResult ( TaskCompleteType . Success , parameters ) , null ) ;
159+ TaskHostTaskComplete complete = new (
160+ new OutOfProcTaskHostTaskResult ( TaskCompleteType . Success , parameters ) ,
161+ #if FEATURE_REPORTFILEACCESSES
162+ null ,
163+ #endif
164+ null) ;
103165
104166 ( ( ITranslatable ) complete ) . Translate ( TranslationHelpers . GetWriteTranslator ( ) ) ;
105167 INodePacket packet = TaskHostTaskComplete . FactoryForDeserialization ( TranslationHelpers . GetReadTranslator ( ) ) ;
@@ -121,7 +183,12 @@ public void TestTranslationWithITaskItemInDictionary()
121183 {
122184 IDictionary < string , object > parameters = new Dictionary < string , object > ( ) ;
123185 parameters . Add ( "TaskItemValue" , new TaskItem ( "Foo" ) ) ;
124- TaskHostTaskComplete complete = new TaskHostTaskComplete ( new OutOfProcTaskHostTaskResult ( TaskCompleteType . Success , parameters ) , null ) ;
186+ TaskHostTaskComplete complete = new (
187+ new OutOfProcTaskHostTaskResult ( TaskCompleteType . Success , parameters ) ,
188+ #if FEATURE_REPORTFILEACCESSES
189+ null ,
190+ #endif
191+ null) ;
125192
126193 ( ( ITranslatable ) complete ) . Translate ( TranslationHelpers . GetWriteTranslator ( ) ) ;
127194 INodePacket packet = TaskHostTaskComplete . FactoryForDeserialization ( TranslationHelpers . GetReadTranslator ( ) ) ;
@@ -142,7 +209,12 @@ public void TestTranslationWithITaskItemArrayInDictionary()
142209 {
143210 IDictionary < string , object > parameters = new Dictionary < string , object > ( ) ;
144211 parameters . Add ( "TaskItemArrayValue" , new ITaskItem [ ] { new TaskItem ( "Foo" ) , new TaskItem ( "Baz" ) } ) ;
145- TaskHostTaskComplete complete = new TaskHostTaskComplete ( new OutOfProcTaskHostTaskResult ( TaskCompleteType . Success , parameters ) , null ) ;
212+ TaskHostTaskComplete complete = new (
213+ new OutOfProcTaskHostTaskResult ( TaskCompleteType . Success , parameters ) ,
214+ #if FEATURE_REPORTFILEACCESSES
215+ null ,
216+ #endif
217+ null) ;
146218
147219 ( ( ITranslatable ) complete ) . Translate ( TranslationHelpers . GetWriteTranslator ( ) ) ;
148220 INodePacket packet = TaskHostTaskComplete . FactoryForDeserialization ( TranslationHelpers . GetReadTranslator ( ) ) ;
@@ -168,7 +240,12 @@ private void AssertInvalidConstructorThrows(Type expectedExceptionType, TaskComp
168240
169241 try
170242 {
171- TaskHostTaskComplete complete = new TaskHostTaskComplete ( new OutOfProcTaskHostTaskResult ( taskResult , taskOutputParameters , taskException , taskExceptionMessage , taskExceptionMessageArgs ) , buildProcessEnvironment ) ;
243+ TaskHostTaskComplete complete = new (
244+ new OutOfProcTaskHostTaskResult ( taskResult , taskOutputParameters , taskException , taskExceptionMessage , taskExceptionMessageArgs ) ,
245+ #if FEATURE_REPORTFILEACCESSES
246+ null ,
247+ #endif
248+ buildProcessEnvironment) ;
172249 }
173250 catch ( Exception e )
174251 {
0 commit comments