public void TestDeterministic2By2Where2Wins() { Election election = this.GenerateElection(2, 2); election.AddBallot(this.FillCandidateNames(2, 1)); election.AddBallot(this.FillCandidateNames(2, 1)); Assert.AreEqual("Candidate 2", election.Winner); }
public void TestDeterministic2By3Where1Wins() { Election election = this.GenerateElection(2, 3); election.AddBallot(this.FillCandidateNames(1, 2, 3)); election.AddBallot(this.FillCandidateNames(1, 2, 3)); Assert.AreEqual("Candidate 1", election.Winner); }
public void TestTied2By2Where2Wins() { Election election = this.GenerateElection(2, 2); this.mockRandom.Setup(random => random.Next(2)).Returns(0); election.AddBallot(this.FillCandidateNames(1, 2)); election.AddBallot(this.FillCandidateNames(2, 1)); Assert.AreEqual("Candidate 2", election.Winner); }
public void TestTied3By3() { Election election = this.GenerateElection(3, 3); this.mockRandom.Setup(random => random.Next(3)).Returns(2); election.AddBallot(this.FillCandidateNames(1, 2, 3)); election.AddBallot(this.FillCandidateNames(3, 1, 2)); election.AddBallot(this.FillCandidateNames(2, 3, 1)); Assert.AreEqual("Candidate 1", election.Winner); }
public void TestComeFromBehind6By4Where1Wins() { Election election = this.GenerateElection(6, 4); this.mockRandom.Setup(random => random.Next(2)).Returns(1); election.AddBallot(this.FillCandidateNames(1, 2, 3, 4)); election.AddBallot(this.FillCandidateNames(2, 1, 3, 4)); election.AddBallot(this.FillCandidateNames(3, 1, 4, 2)); election.AddBallot(this.FillCandidateNames(3, 4, 1, 2)); election.AddBallot(this.FillCandidateNames(4, 1, 3, 2)); election.AddBallot(this.FillCandidateNames(4, 2, 3, 1)); Assert.AreEqual("Candidate 1", election.Winner); }