Exemplo n.º 1
0
        public void TestCompose(double[] votes, int seats)
        {
            Party[] parties = votes.Select(x => new Party(x)).ToArray();
            int     result  = SaintLague.Calculate(parties, seats);

            Assert.AreEqual(seats, result);
            Assert.AreEqual(seats, parties.Sum(x => x.Seats));
        }
Exemplo n.º 2
0
 public void TestArgumentOutOfRange(double[] votes, int seats)
 {
     Party[] parties = votes.Select(x => new Party(x)).ToArray();
     Assert.ThrowsException <ArgumentOutOfRangeException>(() => SaintLague.Calculate(parties, seats));
 }
Exemplo n.º 3
0
 public void TestArgumentNull()
 {
     Assert.ThrowsException <ArgumentNullException>(() => SaintLague.Calculate(null, 0));
     Assert.ThrowsException <ArgumentNullException>(() => SaintLague.Calculate(new SaintLague.IParty[] { new Party(0.3), null }, 0));
 }