Пример #1
0
        public void Wolf_Eats_Weasel()
        {
            Wolf   eater = new Wolf();
            Weasel food  = new Weasel();

            Assert.True(eater.Eat(food));
        }
Пример #2
0
        public void Weasel_Eats_Other()
        {
            Weasel eater             = new Weasel();
            OtherEdibleCritters food = new OtherEdibleCritters();

            Assert.True(eater.Eat(food));
        }
Пример #3
0
        public void Lion_Eats_Weasel()
        {
            Lion   eater = new Lion();
            Weasel food  = new Weasel();

            Assert.True(eater.Eat(food));
        }
Пример #4
0
        static void Main(string[] args)
        {
            // make animals
            Skunk   skunk   = new Skunk();
            Weasel  weasel  = new Weasel();
            Bear    bear    = new Bear();
            Lion    lion    = new Lion();
            Wolf    wolf    = new Wolf();
            Narwhal narwhal = new Narwhal();
            Dolphin dolphin = new Dolphin();
            Orca    orca    = new Orca();

            // make dinner
            IAmDinner rat      = new OtherEdibleCritters();
            IAmDinner mole     = new OtherEdibleCritters();
            IAmDinner guppy    = new OtherEdibleCritters();
            IAmDinner salmon   = new OtherEdibleCritters();
            IAmDinner tuna     = new OtherEdibleCritters();
            IAmDinner sturgeon = new OtherEdibleCritters();
            IAmDinner bass     = new OtherEdibleCritters();

            // setting the stage
            Console.WriteLine("Chaos at the zoo!  All of the enclosures have been torn down by angry environmentalists, and the animals are out of control!");

            // skunk eats mole and births 3 babies
            Console.WriteLine("");
            skunk.Eat(mole);
            skunk.GiveBirth(3);

            // weasel eats rat and births 6 babies
            Console.WriteLine("");
            weasel.Eat(rat);
            weasel.GiveBirth(6);

            // lion and wolf each feast at the newly stocked weasel buffet
            Console.WriteLine("");
            lion.Eat(weasel);
            wolf.Eat(weasel);

            // wolf is expecting, so she also eats a bass
            Console.WriteLine("");
            wolf.Eat(bass);
            wolf.GiveBirth(3);

            // lion also had some buns in the oven
            Console.WriteLine("");
            lion.GiveBirth(4);

            // bear went out for dinner, and then went home to have babies and a nap
            Console.WriteLine("");
            bear.Travel();
            bear.Eat(salmon);
            bear.Travel();
            bear.GiveBirth(1);

            // meanwhile, in the water, everyone had babies!
            Console.WriteLine("");
            narwhal.GiveBirth(1);
            orca.GiveBirth(1);
            dolphin.GiveBirth(1);

            // ...and got hungry
            Console.WriteLine("");
            narwhal.Eat(guppy);
            dolphin.Eat(sturgeon);
            orca.Eat(narwhal);
            orca.Eat(dolphin);

            Console.ReadLine();
        }
Пример #5
0
        public void Weasel_CanBeInstantiated()
        {
            Animal weasel = new Weasel();

            Assert.Equal("weasel", weasel.Species);
        }
Пример #6
0
        public void Weasel_Walks()
        {
            Mammal traveler = new Weasel();

            Assert.Equal("walk", traveler.Travel());
        }