public async Task Schedule_ReentrantHandler_Interleaved()
        {
            // Arrange
            var log = new LogBoard <Tuple <int, int> >();
            var a   = ActorOf(() => new TestScheduleActor(log)).Cast <WorkerRef>();

            // Act
            var t1 = a.Reentrant(1);
            var t2 = a.Reentrant(2);
            await Task.WhenAll(t1, t2);

            // Assert
            Assert.Equal(new[] { 1, 2, 3 },
                         log.Where(t => t.Item1 == 1).Select(t => t.Item2));
            Assert.Equal(new[] { 1, 2, 3 },
                         log.Where(t => t.Item1 == 1).Select(t => t.Item2));
        }
        public async Task AsyncReentrantActor_ObserveSubject(object context)
        {
            // Arrange
            var log     = new LogBoard <string>();
            var subject = ActorOfAsTestActorRef(() => new SubjectActor()).Cast <SubjectRef>();
            var a       = ActorOfAsTestActorRef(() => new TestObserverAsyncReentrantActor(subject, log)).Cast <DummyRef>();

            // Act
            await a.Call(context);

            await a.CastToIActorRef().GracefulStop(TimeSpan.FromMinutes(1), InterfacedPoisonPill.Instance);

            // Assert
            var c = context != null ? context + ":" : "";

            Assert.Equal(new[] { $"{c}A:1", $"{c}A:2" }, log.Where(x => x.StartsWith($"{c}A")));
            Assert.Equal(new[] { $"{c}B:1", $"{c}B:2" }, log.Where(x => x.StartsWith($"{c}B")));
        }