Beispiel #1
0
        private static void PrintSnapshot()
        {
            ActorPoolSnapshot snapshot = ActorPool.Shared.TakeSnapshot();

            foreach ((string key, ActorSnapshot actorSnapshot) in snapshot)
            {
                Console.WriteLine($"{key} => {actorSnapshot}");
            }
        }
Beispiel #2
0
        public void active_actor_should_have_multiple_reference()
        {
            // arrange
            var target = new ActorPool();

            var id = Guid.NewGuid().ToString();

            // act
            using var actor  = target.GetOrCreate(id);
            using var actor2 = target.GetOrCreate(id);

            // assert
            ActorPoolSnapshot snapshot = target.TakeSnapshot();

            snapshot.Count.Should().Be(1);
            snapshot[id].QueuedWork.Should().Be(0);
            snapshot[id].References.Should().Be(2);
        }