コード例 #1
0
        public void TestQuiescentNetwork()
        {
            this.Test(async r =>
            {
                var graphBuilder = new ActorRuntimeLogGraphBuilder(false);
                r.RegisterLog(graphBuilder);

                var op = new ActorHaltedEventGroup();
                var id = r.CreateActor(typeof(NetworkActor), null, op);
                op.AddActor(id);

                // spawn 5 children, each child spawns 4 grand children and those spawn 3, etc.
                // so we should get 1 + 5 + (5*4) + (5*4*3) + (5*4*3*2) actors in this network = 206
                // actors before they are all halted.
                r.SendEvent(id, new SpawnEvent()
                {
                    Count = 5
                }, op);
                var result = await this.GetResultAsync(op.Task);

                string dgml = graphBuilder.Graph.ToString();
                Assert.Equal(206, op.Count);
            },
                      configuration: Configuration.Create().WithPCTStrategy(true));
        }
コード例 #2
0
        public void TestQuiescentNetwork()
        {
            this.Test(async r =>
            {
                var graphBuilder = new ActorRuntimeLogGraphBuilder(false, false);
                r.RegisterLog(graphBuilder);

                var op = new ActorHaltedEventGroup();
                var id = r.CreateActor(typeof(NetworkActor), null, op);
                op.AddActor(id);

                // Spawn 4 children, each child spawns 3 children and those spawn 2, etc.
                // So we should get 41 (1 + 4 + (4*3) + (4*3*2)) actors in the network
                // before they are all halted.
                r.SendEvent(id, new SpawnEvent()
                {
                    Count = 4
                }, op);
                var result = await this.GetResultAsync(op.Task);
                Assert.Equal(41, op.Count);
            });
        }
コード例 #3
0
 internal override Task InitializeAsync(Event initialEvent)
 {
     this.Halted = this.CurrentEventGroup as ActorHaltedEventGroup;
     return(base.InitializeAsync(initialEvent));
 }