This repository was archived by the owner on Dec 5, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +38
-0
lines changed
src/tests/TaskSystemIntegrationTests Expand file tree Collapse file tree 1 file changed +38
-0
lines changed Original file line number Diff line number Diff line change @@ -108,6 +108,44 @@ public async Task ProcessReadsFromStandardInput()
108
108
Assert . AreEqual ( expectedOutput , output ) ;
109
109
}
110
110
111
+ [ Test ]
112
+ public async Task ProcessOnStartOnEndTaskOrder ( )
113
+ {
114
+ var values = new List < string > ( ) ;
115
+ string process1Value = null ;
116
+ string process2Value = null ;
117
+
118
+ var process1Task = new FirstNonNullLineProcessTask ( Token , TestApp , @"-s 100 -d process1" )
119
+ . Configure ( ProcessManager , true ) . Then ( ( b , s ) => {
120
+ process1Value = s ;
121
+ values . Add ( s ) ;
122
+ } ) ;
123
+
124
+ var process2Task = new FirstNonNullLineProcessTask ( Token , TestApp , @"-s 100 -d process2" )
125
+ . Configure ( ProcessManager , true ) . Then ( ( b , s ) => {
126
+ process2Value = s ;
127
+ values . Add ( s ) ;
128
+ } ) ;
129
+
130
+ var combinedTask = process1Task
131
+ . Then ( process2Task ) ;
132
+
133
+ combinedTask . OnStart += task => {
134
+ values . Add ( "OnStart" ) ;
135
+ } ;
136
+
137
+ combinedTask . OnEnd += task => {
138
+ values . Add ( "OnEnd" ) ;
139
+ } ;
140
+
141
+ await combinedTask
142
+ . StartAsAsync ( ) ;
143
+
144
+ Assert . AreEqual ( process1Value , "process1" ) ;
145
+ Assert . AreEqual ( process2Value , "process2" ) ;
146
+ Assert . True ( values . SequenceEqual ( new [ ] { "process1" , "OnStart" , "process2" , "OnEnd" } ) ) ;
147
+ }
148
+
111
149
[ Test ]
112
150
public async Task ProcessReturningErrorThrowsException ( )
113
151
{
You can’t perform that action at this time.
0 commit comments