public void DeathWatch_must_notify_with_a_Terminated_message_once_when_Actor_is_stopped_but_not_when_restarted()
{
EventFilter.Exception<ActorKilledException>().Expect(3, () =>
{
var timeout = TimeSpan.FromSeconds(5);
var supervisor = Sys.ActorOf(Props.Create(() => new Supervisor(
new OneForOneStrategy(2, TimeSpan.FromSeconds(1), r => Directive.Restart))));
var t1 = supervisor.Ask(Props.Create(() => new EchoTestActor()));
t1.Wait(timeout);
var terminal = t1.Result as LocalActorRef;
var t2 = supervisor.Ask(CreateWatchAndForwarderProps(terminal, TestActor), timeout);
t2.Wait(timeout);
var monitor = t2.Result as IActorRef;
terminal.Tell(Kill.Instance);
terminal.Tell(Kill.Instance);
var foo = terminal.Ask("foo", timeout).Result as string;
foo.ShouldBe("foo");
terminal.Tell(Kill.Instance);
ExpectTerminationOf(terminal);
terminal.IsTerminated.ShouldBe(true);
Sys.Stop(supervisor);
});
}