Beispiel #1
0
        public async Task Should_use_async_local()
        {
            var cluster =
                new TestClusterBuilder(1)
                .Build();

            await cluster.DeployAsync();

            try
            {
                var grain = cluster.GrainFactory.GetGrain <IAsyncLocalGrain>(SingleGrain.Id);

                var result1 = await grain.GetValueAsync();

                var result2 = await grain.GetValueAsync();

                await cluster.KillSiloAsync(cluster.Silos[0]);

                await cluster.StartAdditionalSiloAsync();

                var result3 = await grain.GetValueAsync();

                Assert.Equal(1, result1);
                Assert.Equal(1, result2);
                Assert.Equal(1, result3);
            }
            finally
            {
                await Task.WhenAny(Task.Delay(2000), cluster.StopAllSilosAsync());
            }
        }
Beispiel #2
0
        public async Task Should_not_send_message_to_dead_but_not_unregistered_member()
        {
            var cluster =
                new TestClusterBuilder(3)
                .AddSiloBuilderConfigurator <Configurator>()
                .Build();

            await cluster.DeployAsync();

            await cluster.KillSiloAsync(cluster.Silos[1]);

            await PublishAsync(2);

            await cluster.DisposeAsync();
        }