示例#1
0
 public void CalculateFundingWinnerTest()
 {
     Voter v1 = new Voter("rep1");
     Voter v2 = new Voter("rep2");
     Voter v3 = new Voter("rep3");
     PolicyCategory pc = new PolicyCategory("test");
     var fundingOptions = new List<FundingOption>
     {
         new FundingOption("op1", 1, FundingType.ImportTax),
         new FundingOption("op2", 1, FundingType.IncomeTax),
         new FundingOption("op3", 1, FundingType.InheritanceTax)
     };
     Policy pol = new Policy(pc, "pol1", 1);
     var pref1 = new FundingVote(fundingOptions[0], 1);
     var pref2 = new FundingVote(pref1);
     pref2.AddOption(fundingOptions[2], fundingOptions[0]);
     var pref3 = new FundingVote(pref1);
     pref3.AddOption(fundingOptions[1], null);
     PolicyVote vote1 = new PolicyVote(pc, pol, 1, pref1);
     PolicyVote vote2 = new PolicyVote(pc, pol, 1, pref2);
     PolicyVote vote3 = new PolicyVote(pc, pol, 1, pref3);
     v1.Vote(vote1);
     v2.Vote(vote2);
     v3.Vote(vote3);
     Assert.AreEqual(fundingOptions[0], pc.CalculateWinner().Funding);
 }
示例#2
0
 /// <summary>
 /// Add a funding option to the list of options
 /// </summary>
 /// <param name="vote">The funding option to add</param>
 public void AddFundingVote(FundingVote vote)
 {
     this.fundingVotes.Add(vote);
 }