@@ -253,23 +253,33 @@ public void PerformsOpsSerialized()
253253 [ Fact ]
254254 public void PerformsAnyOpsSerialized ( )
255255 {
256+ var callback = "callback" ;
257+ var anyAction = nameof ( TestOwnerAny . Action ) ;
258+ var testAction1 = nameof ( TestOwnerAny . TestAction1 ) ;
259+ var testAction2 = nameof ( TestOwnerAny . TestAction2 ) ;
260+
261+ var testOp1 = new TestOwnerAny . TestOp1 ( ) ;
262+ var testOp2 = new TestOwnerAny . TestOp2 ( ) ;
263+ var number2 = 2 ;
264+
256265 var log = new List < string > ( ) ;
266+
257267 var owner = new TestOwnerAny
258268 {
259269 Action = ( subj , value ) =>
260270 {
261- log . Add ( $ "{ nameof ( TestOwnerAny . Action ) } { value } ") ;
271+ log . Add ( $ "{ anyAction } { value } ") ;
262272 if ( value is int number )
263273 subj . Broadcast ( number ) ;
264274 } ,
265275 TestAction1 = ( subj , value ) =>
266276 {
267- log . Add ( $ "{ nameof ( TestOwnerAny . TestAction1 ) } { value } ") ;
277+ log . Add ( $ "{ testAction1 } { value } ") ;
268278 subj . Broadcast ( value ) ;
269279 } ,
270280 TestAction2 = ( subj , value ) =>
271281 {
272- log . Add ( $ "{ nameof ( TestOwnerAny . TestAction2 ) } { value } ") ;
282+ log . Add ( $ "{ testAction2 } { value } ") ;
273283 subj . Broadcast ( value ) ;
274284 }
275285 } ;
@@ -285,14 +295,14 @@ public void PerformsAnyOpsSerialized()
285295 binding1 . Setup ( b => b . InvokeCallbacks ( It . Ref < TestOwnerAny . TestOp1 > . IsAny ) )
286296 . Callback ( ( in TestOwnerAny . TestOp1 value ) =>
287297 {
288- log . Add ( $ "callback { value } ") ;
298+ log . Add ( $ "{ callback } { value } ") ;
289299 calls ++ ;
290300
291301 subject . IsBusy . ShouldBeTrue ( ) ;
292302
293303 if ( calls == 1 )
294304 {
295- subject . Perform ( new TestOwnerAny . TestOp2 ( ) ) ;
305+ subject . Perform ( testOp2 ) ;
296306 // this should not be broadcast yet
297307 binding2 . Verify (
298308 b2 => b2 . InvokeCallbacks ( It . Ref < TestOwnerAny . TestOp2 > . IsAny ) , Times . Never
@@ -302,22 +312,22 @@ public void PerformsAnyOpsSerialized()
302312
303313 subject . AddBinding ( binding1 . Object ) ;
304314 subject . AddBinding ( binding2 . Object ) ;
305- subject . Perform ( new TestOwnerAny . TestOp1 ( ) ) ;
306- subject . Perform ( 2 ) ;
315+ subject . Perform ( testOp1 ) ;
316+ subject . Perform ( number2 ) ;
307317 subject . IsBusy . ShouldBeFalse ( ) ;
308318
309319 binding2 . Verify ( b2 => b2 . InvokeCallbacks ( It . Ref < TestOwnerAny . TestOp1 > . IsAny ) ) ;
310320 binding2 . Verify ( b2 => b2 . InvokeCallbacks ( It . Ref < TestOwnerAny . TestOp2 > . IsAny ) ) ;
311321 binding2 . Verify ( b2 => b2 . InvokeCallbacks ( 2 ) ) ;
312322
313- // owner should run before bindings each time
323+ // Order should be IPerform then IPerformAnyOperation
314324 log . ShouldBe ( [
315- $ "{ nameof ( TestOwnerAny . TestAction1 ) } { nameof ( TestOwnerAny . TestOp1 ) } {{ }}" ,
316- $ "callback { nameof ( TestOwnerAny . TestOp1 ) } {{ }}" ,
317- $ "{ nameof ( TestOwnerAny . Action ) } { nameof ( TestOwnerAny . TestOp1 ) } {{ }}" ,
318- $ "{ nameof ( TestOwnerAny . TestAction2 ) } { nameof ( TestOwnerAny . TestOp2 ) } {{ }}" ,
319- $ "{ nameof ( TestOwnerAny . Action ) } { nameof ( TestOwnerAny . TestOp2 ) } {{ }}" ,
320- $ "{ nameof ( TestOwnerAny . Action ) } 2"
325+ $ "{ testAction1 } { testOp1 } " , // IPerform<TestOp1>
326+ $ "{ callback } { testOp1 } " , // callback for IPerform<TestOp1>
327+ $ "{ anyAction } { testOp1 } " , // IPerformAnyOperation (TestOp1)
328+ $ "{ testAction2 } { testOp2 } " , //IPerform<TestOp2>
329+ $ "{ anyAction } { testOp2 } " , //IPerformAnyOperation (TestOp2)
330+ $ "{ anyAction } { number2 } " //IPerformAnyOperation (int)
321331 ] ) ;
322332 }
323333
0 commit comments