Пример #1
0
        static void Main(string[] args)
        {
            LizardWizard  lizard  = new LizardWizard();
            Human         human   = new Human();
            Crocilligator croc    = new Crocilligator();
            MegaHamster   hamster = new MegaHamster(600);
            Monkey        monkey  = new Monkey();
            RattleSnek    snake   = new RattleSnek();

            Animal[] animals = { lizard, human, croc, hamster, monkey, snake };

            foreach (Animal animal in animals)
            {
                Console.WriteLine($"{animal.GetType().ToString()} is an Animal: {animal.IsAnimal}");
                animal.Move();
            }

            human.Swim();
            croc.Swim();
            monkey.Fly();
            lizard.Fly();
            human.Fly();
        }
Пример #2
0
        public void LizWizCanFly()
        {
            IFly levitatingLizard = new LizardWizard();

            Assert.Equal("LizardWizard flew", levitatingLizard.Fly());
        }