コード例 #1
0
        static void Main(string[] args)
        {
            try
            {
                var lotto    = new Lottery("Lotto", 45, 45, 6, 1);
                var euromill = new Lottery("Euromillions", 50, 12, 5, 2);
                var joker    = new Lottery("Joker", 90, 0, 5, 0);

                lotto.set_gamedays(3, 7);
                euromill.set_gamedays(2, 5);

                lotto.print();
                euromill.print();

                Console.WriteLine(lotto.get_instructions());
                Console.WriteLine(euromill.get_instructions());
                Console.WriteLine(joker.get_instructions());

                var Liste = euromill.generate_numbers();
                Liste.ForEach(i => Console.Write("{0}\t", i));
            }
            catch (ArgumentException ex)
            {
                Console.WriteLine(ex.Message);
            }
        }
コード例 #2
0
ファイル: Tests.cs プロジェクト: kanimar/oom
 public void no_lottery_without_main_to_draw()
 {
     Assert.Catch(() =>
     {
         var lot = new Lottery("Name", 0, 12, 0, 2);
     }
                  );
 }
コード例 #3
0
        public void check_constructor()
        {
            var lot = new Lottery("Name", 50, 12, 5, 2);

            Assert.That(lot.Name, Has.Length.GreaterThan(2));
            Assert.IsTrue(lot.main_balls == 50);
            Assert.IsTrue(lot.main_to_draw == 5);
            Assert.IsTrue(lot.bonus_balls == 12);
            Assert.IsTrue(lot.bonus_to_draw == 2);
        }
コード例 #4
0
        public void check_amnt_of_no_to_gen()
        {
            var lot = new Lottery("Name", 50, 12, 5, 2);

            var        count_to_draw = lot.main_to_draw + lot.bonus_to_draw;
            List <int> list          = lot.generate_rand();

            Assert.That(list.Count, Is.Not.Null.And.
                        EqualTo(count_to_draw));
        }
コード例 #5
0
        public void list_in_asc_order_and_unique()
        {
            var        lot        = new Lottery("Name", 50, 12, 5, 2);
            List <int> list       = lot.generate_rand();
            List <int> main_list  = list.GetRange(0, lot.main_to_draw);
            List <int> bonus_list = list.GetRange(lot.main_to_draw, lot.bonus_to_draw);

            Assert.That(main_list, Is.Ordered.Ascending);
            Assert.That(main_list, Is.Unique);
            Assert.That(bonus_list, Is.Ordered.Ascending);
            Assert.That(bonus_list, Is.Unique);
        }
コード例 #6
0
ファイル: Program.cs プロジェクト: kanimar/oom
        static void Main(string[] args)
        {
            try
            {
                var game1 = new Lottery("Lotto", 45, 45, 6, 1);
                var game2 = new Lottery("Euromillions", 50, 12, 5, 2);
                var game3 = new Lottery("Joker", 90, 0, 5, 0);
                var game4 = new Scratch_card("Cash");

                IGambling[] games = new IGambling[] { game1, game2, game3, game4 };

                foreach (var g in games)
                {
                    g.get_instructions();
                    g.print_list(g.generate_rand(), g.Name);
                }
            }
            catch (ArgumentException ex)
            {
                Console.WriteLine(ex.Message);
            }
        }
コード例 #7
0
        public void all_list_items_in_range()
        {
            var lot = new Lottery("Name", 45, 0, 6, 0);

            Assert.That(lot.generate_rand(), Is.All.InRange(1, lot.main_balls));
        }