Ejemplo n.º 1
0
        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);
        }