@@ -34,7 +34,7 @@ public async Task AllForOneStrategy_Should_ResumeChildOnFailure()
3434
3535 context . Send ( parent , "hello" ) ;
3636
37- child1MailboxStats . Reset . Wait ( 5000 ) ;
37+ Assert . True ( child1MailboxStats . Reset . Wait ( TimeSpan . FromSeconds ( 5 ) ) ) ;
3838 Assert . Contains ( ResumeMailbox . Instance , child1MailboxStats . Posted ) ;
3939 Assert . Contains ( ResumeMailbox . Instance , child1MailboxStats . Received ) ;
4040 Assert . DoesNotContain ( ResumeMailbox . Instance , child2MailboxStats . Posted ) ;
@@ -47,8 +47,8 @@ public async Task AllForOneStrategy_Should_StopAllChildrenOnFailure()
4747 await using var system = new ActorSystem ( ) ;
4848 var context = system . Root ;
4949
50- var child1MailboxStats = new TestMailboxStatistics ( msg => msg is Stopped ) ;
51- var child2MailboxStats = new TestMailboxStatistics ( msg => msg is Stopped ) ;
50+ var child1MailboxStats = new TestMailboxStatistics ( msg => msg is Stop ) ;
51+ var child2MailboxStats = new TestMailboxStatistics ( msg => msg is Stop ) ;
5252 var strategy = new AllForOneStrategy ( ( pid , reason ) => SupervisorDirective . Stop , 1 , null ) ;
5353
5454 var child1Props = Props . FromProducer ( ( ) => new ChildActor ( ) )
@@ -64,8 +64,8 @@ public async Task AllForOneStrategy_Should_StopAllChildrenOnFailure()
6464
6565 context . Send ( parent , "hello" ) ;
6666
67- child1MailboxStats . Reset . Wait ( 1000 ) ;
68- child2MailboxStats . Reset . Wait ( 1000 ) ;
67+ Assert . True ( child1MailboxStats . Reset . Wait ( TimeSpan . FromSeconds ( 5 ) ) ) ;
68+ Assert . True ( child2MailboxStats . Reset . Wait ( TimeSpan . FromSeconds ( 5 ) ) ) ;
6969 Assert . Contains ( Stop . Instance , child1MailboxStats . Posted ) ;
7070 Assert . Contains ( Stop . Instance , child1MailboxStats . Received ) ;
7171 Assert . Contains ( Stop . Instance , child2MailboxStats . Posted ) ;
@@ -78,8 +78,8 @@ public async Task AllForOneStrategy_Should_RestartAllChildrenOnFailure()
7878 await using var system = new ActorSystem ( ) ;
7979 var context = system . Root ;
8080
81- var child1MailboxStats = new TestMailboxStatistics ( msg => msg is Stopped ) ;
82- var child2MailboxStats = new TestMailboxStatistics ( msg => msg is Stopped ) ;
81+ var child1MailboxStats = new TestMailboxStatistics ( msg => msg is Restart ) ;
82+ var child2MailboxStats = new TestMailboxStatistics ( msg => msg is Restart ) ;
8383 var strategy = new AllForOneStrategy ( ( pid , reason ) => SupervisorDirective . Restart , 1 , null ) ;
8484
8585 var child1Props = Props . FromProducer ( ( ) => new ChildActor ( ) )
@@ -95,8 +95,8 @@ public async Task AllForOneStrategy_Should_RestartAllChildrenOnFailure()
9595
9696 context . Send ( parent , "hello" ) ;
9797
98- child1MailboxStats . Reset . Wait ( 1000 ) ;
99- child2MailboxStats . Reset . Wait ( 1000 ) ;
98+ Assert . True ( child1MailboxStats . Reset . Wait ( TimeSpan . FromSeconds ( 5 ) ) ) ;
99+ Assert . True ( child2MailboxStats . Reset . Wait ( TimeSpan . FromSeconds ( 5 ) ) ) ;
100100 Assert . Contains ( child1MailboxStats . Posted , msg => msg is Restart ) ;
101101 Assert . Contains ( child1MailboxStats . Received , msg => msg is Restart ) ;
102102 Assert . Contains ( child2MailboxStats . Posted , msg => msg is Restart ) ;
@@ -109,8 +109,8 @@ public async Task AllForOneStrategy_Should_PassExceptionOnRestart()
109109 await using var system = new ActorSystem ( ) ;
110110 var context = system . Root ;
111111
112- var child1MailboxStats = new TestMailboxStatistics ( msg => msg is Stopped ) ;
113- var child2MailboxStats = new TestMailboxStatistics ( msg => msg is Stopped ) ;
112+ var child1MailboxStats = new TestMailboxStatistics ( msg => msg is Restart ) ;
113+ var child2MailboxStats = new TestMailboxStatistics ( msg => msg is Restart ) ;
114114 var strategy = new AllForOneStrategy ( ( pid , reason ) => SupervisorDirective . Restart , 1 , null ) ;
115115
116116 var child1Props = Props . FromProducer ( ( ) => new ChildActor ( ) )
@@ -126,8 +126,8 @@ public async Task AllForOneStrategy_Should_PassExceptionOnRestart()
126126
127127 context . Send ( parent , "hello" ) ;
128128
129- child1MailboxStats . Reset . Wait ( 1000 ) ;
130- child2MailboxStats . Reset . Wait ( 1000 ) ;
129+ Assert . True ( child1MailboxStats . Reset . Wait ( TimeSpan . FromSeconds ( 5 ) ) ) ;
130+ Assert . True ( child2MailboxStats . Reset . Wait ( TimeSpan . FromSeconds ( 5 ) ) ) ;
131131 Assert . Contains ( child1MailboxStats . Posted , msg => msg is Restart r && r . Reason == Exception ) ;
132132 Assert . Contains ( child1MailboxStats . Received , msg => msg is Restart r && r . Reason == Exception ) ;
133133 Assert . Contains ( child2MailboxStats . Posted , msg => msg is Restart r && r . Reason == Exception ) ;
@@ -140,7 +140,7 @@ public async Task AllForOneStrategy_Should_EscalateFailureToParent()
140140 await using var system = new ActorSystem ( ) ;
141141 var context = system . Root ;
142142
143- var parentMailboxStats = new TestMailboxStatistics ( msg => msg is Stopped ) ;
143+ var parentMailboxStats = new TestMailboxStatistics ( msg => msg is Failure ) ;
144144 var strategy = new AllForOneStrategy ( ( pid , reason ) => SupervisorDirective . Escalate , 1 , null ) ;
145145 var childProps = Props . FromProducer ( ( ) => new ChildActor ( ) ) ;
146146
@@ -152,7 +152,7 @@ public async Task AllForOneStrategy_Should_EscalateFailureToParent()
152152
153153 context . Send ( parent , "hello" ) ;
154154
155- parentMailboxStats . Reset . Wait ( 1000 ) ;
155+ Assert . True ( parentMailboxStats . Reset . Wait ( TimeSpan . FromSeconds ( 5 ) ) ) ;
156156 var failure = parentMailboxStats . Received . OfType < Failure > ( ) . Single ( ) ;
157157 Assert . IsType < Exception > ( failure . Reason ) ;
158158 }
0 commit comments