public void DeathWatch_must_discard_Terminated_when_unwatched_between_sysmsg_and_processing()
{
var t1 = CreateTestLatch(1);
var t2 = CreateTestLatch(1);
var p = CreateTestProbe();
var w = Sys.ActorOf(Props.Create(() => new Watcher()).WithDeploy(Deploy.Local), "testWatcher");
w.Tell(new W(p.Ref));
w.Tell(new Latches(t1, t2));
t1.Ready(TimeSpan.FromSeconds(3));
Watch(p.Ref);
Sys.Stop(p.Ref);
ExpectTerminated(p.Ref);
w.Tell(new U(p.Ref));
t2.CountDown();
// now the Watcher will
// - process the DeathWatchNotification and enqueue Terminated
// - process the unwatch command
// - process the Terminated
// If it receives the Terminated it will die, which in fact it should not
w.Tell(new Identify(null));
ExpectMsg<ActorIdentity>(ai => ai.Subject == w);
w.Tell(new Identify(null));
ExpectMsg<ActorIdentity>(ai => ai.Subject == w);
}