Esempio n. 1
0
        public void TestInitiialize()
        {
            Aviary = new Zoo("Aviary", 0);
            Creator cr      = new BearCreator("Ben", 300);
            Animal  animal1 = cr.Add(cr.Name, cr.Weight);

            Aviary.Add(animal1);
            Creator cr2     = new GiraffeCreator("Buch", 300);
            Animal  animal2 = cr2.Add(cr2.Name, cr2.Weight);

            Aviary.Add(animal2);
        }
Esempio n. 2
0
        static Animal AnimalCreator(Zone zone)
        {
            Creator creator = null;
            int     i       = 1;

            Console.WriteLine("Please select species from the list and enter the number:");

            foreach (SpeciesType species in Enum.GetValues(typeof(SpeciesType)))
            {
                Console.WriteLine($"{i}. {species}");
                i++;
            }

            while (true)
            {
                switch (Console.ReadLine())
                {
                case "1":
                    creator = new BearCreator(zone);
                    break;

                case "2":
                    creator = new GorillaCreator(zone);
                    break;

                case "3":
                    creator = new LionCreator(zone);
                    break;

                case "4":
                    creator = new PenguinCreator(zone);
                    break;

                case "5":
                    creator = new SealCreator(zone);
                    break;

                case "6":
                    creator = new WolfCreator(zone);
                    break;

                case "7":
                    creator = new ElephantCreator(zone);
                    break;

                case "8":
                    creator = new GiraffeCreator(zone);
                    break;

                case "9":
                    creator = new HippopotamusCreator(zone);
                    break;

                case "10":
                    creator = new KoalaCreator(zone);
                    break;

                case "11":
                    creator = new ZebraCreator(zone);
                    break;

                default:
                    Console.WriteLine("No such animal available! Please try again");
                    break;
                }
                if (creator != null)
                {
                    break;
                }
            }
            return(creator.Create());
        }