public void ComputeMostFrequentNumbers() { LotteryGame kenoGame = new LotteryGame("Keno Game"); Draw draw1 = new Draw(); draw1.AddDrawNumber(2); draw1.AddDrawNumber(36); draw1.AddDrawNumber(45); draw1.AddDrawNumber(29); draw1.AddDrawNumber(63); draw1.AddDrawNumber(78); draw1.AddDrawNumber(80); draw1.AddDrawNumber(16); draw1.AddDrawNumber(56); draw1.AddDrawNumber(52); draw1.AddDrawNumber(58); draw1.AddDrawNumber(8); Draw draw2 = new Draw(); draw2.AddDrawNumber(2); draw2.AddDrawNumber(67); draw2.AddDrawNumber(45); draw2.AddDrawNumber(24); draw2.AddDrawNumber(60); draw2.AddDrawNumber(23); draw2.AddDrawNumber(66); draw2.AddDrawNumber(53); draw2.AddDrawNumber(20); draw2.AddDrawNumber(44); draw2.AddDrawNumber(51); draw2.AddDrawNumber(9); Draw draw3 = new Draw(); draw3.AddDrawNumber(2); draw3.AddDrawNumber(67); draw3.AddDrawNumber(43); draw3.AddDrawNumber(25); draw3.AddDrawNumber(61); draw3.AddDrawNumber(22); draw3.AddDrawNumber(33); draw3.AddDrawNumber(55); draw3.AddDrawNumber(19); draw3.AddDrawNumber(57); draw3.AddDrawNumber(3); draw3.AddDrawNumber(6); kenoGame.AddDraw(draw1); kenoGame.AddDraw(draw2); kenoGame.AddDraw(draw3); var countDictionary = new Dictionary <int, int>(); countDictionary.Add(2, 3); countDictionary.Add(45, 2); countDictionary.Add(67, 2); LotteryStatistics result = kenoGame.ComputeStatistics(); CollectionAssert.AreEqual(countDictionary, result.ThreeMostNumbers); }
public void TestCheckNumbers() { LotteryGame kenoGame = new LotteryGame("Keno Game"); Draw draw = new Draw(); draw.AddDrawNumber(2); draw.AddDrawNumber(36); draw.AddDrawNumber(45); draw.AddDrawNumber(29); draw.AddDrawNumber(63); draw.AddDrawNumber(78); draw.AddDrawNumber(80); draw.AddDrawNumber(16); draw.AddDrawNumber(56); draw.AddDrawNumber(52); draw.AddDrawNumber(58); draw.AddDrawNumber(8); LotteryTicket ticket = new LotteryTicket(); ticket.AddSelectedNumber(36); ticket.AddSelectedNumber(3); ticket.AddSelectedNumber(28); ticket.AddSelectedNumber(78); ticket.AddSelectedNumber(30); ticket.AddSelectedNumber(10); kenoGame.AddDraw(draw); draw.AddTicket(ticket); var wonNumbers = new List <int> { 36, 78 }; TicketChecker checker = kenoGame.CheckResults(); Assert.AreEqual(TicketChecker.ReturnStatus.Success, checker.Message); CollectionAssert.AreEqual(ticket.WinningNumbers, wonNumbers); }