Slide 62
Slide 62 text
Election Scenario
as Test (cont’d)
// It is 8:30pm and Ward 3 has indicated the following results:
$vinceBrennan->setVotes(354);
$lynnMesick->setVotes(171);
$ronRuloff->setVotes(63);
$this->assertEquals(.602, $vinceBrennan->getFractionOfVotes());
$this->assertEquals(.291, $lynnMesick->getFractionOfVotes());
$this->assertEquals(.107, $ronRuloff->getFractionOfVotes());
// This Election has a Winning Threshold of 40%…
$winningPolicy = new WinningThreshold(.40, $cityCouncilor);
// …so Candidate Vince Brennan (P) appears to be the winner.
$winners = $winningPolicy->determineWinners();
$this->assertContains($vinceBrennan, $winners);
$this->assertNotContains($lynnMesick, $winners);
$this->assertNotContains($ronRuloff, $winners);