예제 #1
0
 private Vote PrepareRunningVote()
 {
     Vote vote = new Vote();
     List<Mock<IVoter>> voterMocks = GenenerateVoterMocks(10);
     List<TaskCompletionSource<bool>> votingCompletionSources = SetupRequestVoteMethods(voterMocks);
     Task<bool> votingTask = vote.CallVote(voterMocks.Select(mock => mock.Object));
     Assert.AreEqual(TaskStatus.WaitingForActivation, votingTask.Status);
     return vote;
 }
예제 #2
0
 private Vote PrepareCompletedVote()
 {
     Vote vote = new Vote();
     List<Mock<IVoter>> voterMocks = GenenerateVoterMocks(10);
     List<TaskCompletionSource<bool>> votingCompletionSources = SetupRequestVoteMethods(voterMocks);
     Task<bool> votingTask = vote.CallVote(voterMocks.Select(mock => mock.Object));
     CompleteVotesInParallel(votingCompletionSources, true);
     Assert.IsTrue(votingTask.Wait(TimeoutForVotesToBeCounted));
     return vote;
 }