protected override bool Receive(object message) { global::System.Diagnostics.Debug.WriteLine("TestActor received " + message); var setIgnore = message as TestKit.TestActor.SetIgnore; if (setIgnore != null) { _ignore = setIgnore.Ignore; return(true); } var watch = message as TestKit.TestActor.Watch; if (watch != null) { Context.Watch(watch.Actor); return(true); } var unwatch = message as TestKit.TestActor.Unwatch; if (unwatch != null) { Context.Unwatch(unwatch.Actor); return(true); } var setAutoPilot = message as TestKit.TestActor.SetAutoPilot; if (setAutoPilot != null) { _autoPilot = setAutoPilot.AutoPilot; return(true); } var actorRef = Sender; if (_autoPilot != null) { var newAutoPilot = _autoPilot.Run(actorRef, message); if (!(newAutoPilot is KeepRunning)) { _autoPilot = newAutoPilot; } } if (_ignore == null || !_ignore(message)) { _queue.Enqueue(new RealMessageEnvelope(message, actorRef)); } return(true); }
protected override bool Receive(object message) { global::System.Diagnostics.Debug.WriteLine("TestActor received " + message); var setIgnore = message as TestKit.TestActor.SetIgnore; if(setIgnore != null) { _ignore = setIgnore.Ignore; return true; } var watch = message as TestKit.TestActor.Watch; if(watch != null) { Context.Watch(watch.Actor); return true; } var unwatch = message as TestKit.TestActor.Unwatch; if(unwatch != null) { Context.Unwatch(unwatch.Actor); return true; } var setAutoPilot = message as TestKit.TestActor.SetAutoPilot; if(setAutoPilot != null) { _autoPilot = setAutoPilot.AutoPilot; return true; } var actorRef = Sender; if(_autoPilot != null) { var newAutoPilot = _autoPilot.Run(actorRef, message); if(!(newAutoPilot is KeepRunning)) _autoPilot = newAutoPilot; } if(_ignore == null || !_ignore(message)) _queue.Enqueue(new RealMessageEnvelope(message, actorRef)); return true; }