public void Should_Kingdom_WhenTwoCompetingKingdomGetZeroAllies() { //when ballotSystem = new BallotSystem(competing, kingdoms, new RandomizeMessage(new InMemoryMessageSource()), 6); Assert.IsTrue(ballotSystem.IsReElectionRequired()); ballotSystem.AddMessageToBallot(competing[2], kingdoms[5], "Gorilla"); ballotSystem.SendMessageToKingdom(); //then Assert.AreEqual(competing[2], ballotSystem.GetKingdomWithMaxAllies()); Assert.AreEqual(1, ballotSystem.GetKingdomWithMaxAllies().GetAlliesCount()); }
public void Should_True_ReElectionRequiredIfOneKingdomCompetingAndGotZeroAllies() { ballotSystem = new BallotSystem(new List <Kingdom>() { kingdoms[0] }, kingdoms); ballotSystem.AddMessageToBallot(competing[0], kingdoms[3], "xxxxx"); ballotSystem.SendMessageToKingdom(); Assert.IsTrue(ballotSystem.IsReElectionRequired()); ballotSystem.ReElectionSetup(); ballotSystem.AddMessageToBallot(competing[0], kingdoms[3], "Owl"); ballotSystem.SendMessageToKingdom(); Assert.AreEqual(competing[0], ballotSystem.GetKingdomWithMaxAllies()); Assert.AreEqual(1, ballotSystem.GetKingdomWithMaxAllies().GetAlliesCount()); }