Ejemplo n.º 1
0
        /// <summary>
        /// Update the observable collection of voters.
        /// </summary>
        private void UpdateVotersCollection()
        {
            var voteVoters = VoteCounter.GetVotersCollection(VoteType.Vote);
            var rankVoters = VoteCounter.GetVotersCollection(VoteType.Rank);

            List <string> voters = voteVoters.Select(v => v.Key)
                                   .Concat(rankVoters.Select(v => v.Key))
                                   .Distinct().OrderBy(v => v).ToList();

            AllVotersCollection.Replace(voters);

            OnPropertyChanged(nameof(AllVotersCollection));
        }
Ejemplo n.º 2
0
        public void ResetTest()
        {
            voteCounter.Reset();

            Assert.AreEqual(0, voteCounter.GetVotersCollection(VoteType.Vote).Count);
            Assert.AreEqual(0, voteCounter.GetVotesCollection(VoteType.Vote).Count);
            Assert.AreEqual(0, voteCounter.GetVotersCollection(VoteType.Rank).Count);
            Assert.AreEqual(0, voteCounter.GetVotesCollection(VoteType.Rank).Count);

            Assert.AreEqual(0, voteCounter.ReferencePlanNames.Count);
            Assert.AreEqual(0, voteCounter.ReferencePlans.Count);
            Assert.AreEqual(0, voteCounter.ReferenceVoters.Count);
            Assert.AreEqual(0, voteCounter.ReferenceVoterPosts.Count);
            Assert.AreEqual(0, voteCounter.FutureReferences.Count);

            Assert.AreEqual(0, voteCounter.PlanNames.Count);
            Assert.AreEqual("", voteCounter.Title);
        }