Exemplo n.º 1
0
        public bool Vote(Elector elector, ElectoralList list)
        {
            var previousVote = VoteRepository.Get(elector);

            if (!(previousVote is null))
            {
                throw new ElectorException(Messages.DuplicatedVote);
            }

            var districtsList = new List <District>(list.Districts);

            if (!districtsList.Contains(elector.District))
            {
                throw new ElectorException(Messages.OutOfDistrictVote);
            }

            VoteRepository.Add(elector, list);

            return(true);
        }
Exemplo n.º 2
0
 public bool Vote(Elector elector, ElectoralList list)
 {
     return(VoteCounter.Vote(elector, list));
 }