public async Task ActivateGrainWithState()
        {
            var grain = Cluster.GrainFactory.GetGrain <ITestGrain>("a-key-with-init-state-mp-serialized");
            var mock  = MockState.Generate();

            var done = new TaskCompletionSource <bool>();

            var provider = Cluster.Client.GetStreamProvider("TestStream");
            var stream   = provider.GetStream <string>(Consts.StreamGuid, "deactivate-notifications");
            await stream.SubscribeAsync((message, seq) =>
            {
                done.SetResult(true);
                return(Task.CompletedTask);
            });

            await grain.SaveMe(mock);

            await grain.Deactivate();

            await done.Task;

            var state = await grain.GetTheState();

            Assert.Equal(mock, state);
        }
		public async Task SecondProvider()
		{
			var grain = Cluster.GrainFactory.GetGrain<ITestGrain2>("a-key-for-the second-provider");
			var mock = MockState.Generate();

			await grain.SaveMe(mock);

			var state = await grain.GetTheState();
			Assert.Equal(mock, state);
		}
		public async Task MultipleWrites()
		{
			var grain = Cluster.GrainFactory.GetGrain<ITestGrain>("a-key-for-clearing-state");
			var mock = MockState.Generate();

			await grain.SaveMe(mock);
			var state = await grain.GetTheState();
			Assert.Equal(mock, state);

			var mock2 = MockState.Generate();

			await grain.SaveMe(mock2);
			var state2 = await grain.GetTheState();
			Assert.Equal(mock2, state2);
		}