public async Task LearnOfNewTermThroughRequestVote()
        {
            await this.role.Enter();
            this.persistentState.CurrentTerm.Returns(_ => 1);
            this.persistentState.VotedFor.Returns(_ => this.identity.Id);

            var request = new RequestVoteRequest(2, "Napoleon", default(LogEntryId));
            await this.role.RequestVote(request);
            await this.coordinator.Received().StepDownIfGreaterTerm(request);
        }
        public async Task RequestsVotesOnEntry()
        {
            // Setup: configure grains to always grant votes
            this.OnRaftGrainCreated = (id, grain) =>
            {
                var raftGrain = grain;
                raftGrain?.RequestVote(Arg.Any<RequestVoteRequest>())
                    .Returns(Task.FromResult(new RequestVoteResponse { Term = 1, VoteGranted = true }));
            };

            await this.role.Enter();

            foreach (var server in this.members.AllServers)
            {
                var grain = this.grainFactory.GetGrain<IRaftGrain<int>>(server);
                if (string.Equals(server, this.identity.Id, StringComparison.Ordinal))
                {
                    await grain.DidNotReceive().RequestVote(Arg.Any<RequestVoteRequest>());
                    continue;
                }

                var request = new RequestVoteRequest(
                    this.persistentState.CurrentTerm,
                    this.identity.Id,
                    this.journal.LastLogEntryId);

                await grain.Received().RequestVote(request);
            }
        }