@@ -52,41 +52,30 @@ protected override bool Receive(object message)
52
52
throw ;
53
53
}
54
54
55
- var setIgnore = message as TestKit . TestActor . SetIgnore ;
56
- if ( setIgnore != null )
55
+ switch ( message )
57
56
{
58
- _ignore = setIgnore . Ignore ;
59
- return true ;
60
- }
61
- var watch = message as TestKit . TestActor . Watch ;
62
- if ( watch != null )
63
- {
64
- Context . Watch ( watch . Actor ) ;
65
- return true ;
66
- }
67
- var unwatch = message as TestKit . TestActor . Unwatch ;
68
- if ( unwatch != null )
69
- {
70
- Context . Unwatch ( unwatch . Actor ) ;
71
- return true ;
72
- }
73
- var setAutoPilot = message as TestKit . TestActor . SetAutoPilot ;
74
- if ( setAutoPilot != null )
75
- {
76
- _autoPilot = setAutoPilot . AutoPilot ;
77
- return true ;
78
- }
79
-
80
- var spawn = message as TestKit . TestActor . Spawn ;
81
- if ( spawn != null )
82
- {
83
- var actor = spawn . Apply ( Context ) ;
84
- if ( spawn . _supervisorStrategy . HasValue )
57
+ case TestActor . SetIgnore setIgnore :
58
+ _ignore = setIgnore . Ignore ;
59
+ return true ;
60
+ case TestActor . Watch watch :
61
+ Context . Watch ( watch . Actor ) ;
62
+ return true ;
63
+ case TestActor . Unwatch unwatch :
64
+ Context . Unwatch ( unwatch . Actor ) ;
65
+ return true ;
66
+ case TestActor . SetAutoPilot setAutoPilot :
67
+ _autoPilot = setAutoPilot . AutoPilot ;
68
+ return true ;
69
+ case TestActor . Spawn spawn :
85
70
{
86
- _supervisorStrategy . Update ( actor , spawn . _supervisorStrategy . Value ) ;
71
+ var actor = spawn . Apply ( Context ) ;
72
+ if ( spawn . _supervisorStrategy . HasValue )
73
+ {
74
+ _supervisorStrategy . Update ( actor , spawn . _supervisorStrategy . Value ) ;
75
+ }
76
+ _queue . Enqueue ( new RealMessageEnvelope ( actor , Self ) ) ;
77
+ return true ;
87
78
}
88
- _queue . Enqueue ( new RealMessageEnvelope ( actor , Self ) ) ;
89
- return true ;
90
79
}
91
80
92
81
var actorRef = Sender ;
@@ -100,19 +89,5 @@ protected override bool Receive(object message)
100
89
_queue . Enqueue ( new RealMessageEnvelope ( message , actorRef ) ) ;
101
90
return true ;
102
91
}
103
-
104
- /// <summary>
105
- /// TBD
106
- /// </summary>
107
- protected override void PostStop ( )
108
- {
109
- var self = Self ;
110
- foreach ( var messageEnvelope in _queue . ToList ( ) )
111
- {
112
- var messageSender = messageEnvelope . Sender ;
113
- var message = messageEnvelope . Message ;
114
- Context . System . DeadLetters . Tell ( new DeadLetter ( message , messageSender , self ) , messageSender ) ;
115
- }
116
- }
117
92
}
118
93
}
0 commit comments