Ejemplo n.º 1
0
        public void Given_ValidParameters_When_CallingPlaceVote_Then_IncrementsPartyVoteCount()
        {
            var  commission = new ElectoralCommission();
            var  dave       = new Person("Dave", "Wozniak", "12345678901", new DateTime(1998, 3, 11));
            var  party      = new Party("WASD");
            var  vote       = new Vote(party);
            uint expected   = 1;

            commission.PlaceVote(dave, vote);
            var actual = party.GetVoteCount();

            Assert.Equal(expected, actual);
        }
Ejemplo n.º 2
0
        public void Given_ValidCollectionWithoutAnyVotes_When_CallingDetermineWinner_Then_ReturnsNull()
        {
            var commission = new ElectoralCommission();
            Dictionary <string, Party> parties = new Dictionary <string, Party>
            {
                { "WASD", new Party("WASD") },
                { "QWERTY", new Party("QWERTY") },
                { "SPACE", new Party("SPACE") }
            };

            var result = commission.DetermineWinner(parties);

            Assert.Null(result);
        }
Ejemplo n.º 3
0
        public void Given_InvalidParameters_When_CallingPlaceVote_Then_ThrowsArgumentNullException(Person person, Vote vote)
        {
            var commission = new ElectoralCommission();

            Assert.Throws <ArgumentNullException>(() => commission.PlaceVote(person, vote));
        }