Example #1
0
        public void GreatWhiteShark_is_an_animal_and_a_fish()
        {
            // Arrange
            GreatWhiteShark shark = new GreatWhiteShark();

            // Assert
            Assert.True(shark is Animal);
        }
Example #2
0
        public void ForBruceTheWhiteSharkWhenHeSmellBloodInTheWater()
        {
            GreatWhiteShark bruce = new GreatWhiteShark();

            string beforeOhNo = bruce.Food;

            string ohNo = bruce.FishAreFriend();

            Assert.DoesNotMatch(beforeOhNo, ohNo);
        }
Example #3
0
        public void GreatWhiteShark_has_name_diet_sound_home()
        {
            // Arrange
            GreatWhiteShark shark = new GreatWhiteShark();

            // Assert
            Assert.Equal("Silence", shark.Sound);
            Assert.Equal("Carnivore", shark.Diet);
            Assert.Equal("Great White Shark", shark.Name);
            Assert.Equal("Ocean", shark.Home);
        }
Example #4
0
        public void TestingIfSharkIsMammal()
        {
            bool            isIt  = false;
            GreatWhiteShark bruce = new GreatWhiteShark();

            if (bruce is Mammal)
            {
                isIt = true;
            }

            Assert.False(isIt);
        }
Example #5
0
        static void Main(string[] args)
        {
            GreatWhiteShark shark = new GreatWhiteShark();

            Console.WriteLine("The Great White Shark");
            Console.WriteLine(shark.Sound());
            Console.WriteLine(shark.Diet());
            Console.WriteLine(shark.Habitat());
            Console.WriteLine($"has {shark.LegCount} legs");
            Console.WriteLine(shark.IsNocturnal);
            Console.WriteLine($" would I make good sushi? {shark.Sushiable}");
            Console.ReadKey();
        }
Example #6
0
        public void ISwimTestShark()
        {
            // Arrange
            TigerShark      tigerShark      = new TigerShark();
            GreatWhiteShark greatWhiteShark = new GreatWhiteShark();

            // Act
            string tigSing     = tigerShark.Sing();
            string greatWSSing = greatWhiteShark.Sing();

            // Assert
            Assert.Equal("Under the sea, under the sea", tigSing);
            Assert.Equal("Under the sea, under the sea", greatWSSing);
        }
        /// <summary>
        /// This just tests that the classes inherit properties
        /// </summary>
        static void Proof()
        {
            ChannelCatfish   channelCatfish   = new ChannelCatfish();
            FlatheadCatfish  flatheadCatfish  = new FlatheadCatfish();
            TigerShark       tigerShark       = new TigerShark();
            GreatWhiteShark  greatWhiteShark  = new GreatWhiteShark();
            EmperorPenguin   emperorPenguin   = new EmperorPenguin();
            GalapagosPenguin galapagosPenguin = new GalapagosPenguin();
            Mallard          mallard          = new Mallard();
            MandarinDuck     mandarinDuck     = new MandarinDuck();
            PrairieFalcon    prairieFalcon    = new PrairieFalcon();
            Gyrfalcon        gyrfalcon        = new Gyrfalcon();
            Dragon           dragon           = new Dragon();
            KomodoDragon     komodoDragon     = new KomodoDragon();
            Anaconda         anaconda         = new Anaconda();
            Rattlesnake      rattlesnake      = new Rattlesnake();
            Dhole            dhole            = new Dhole();
            TundraWolf       tundraWolf       = new TundraWolf();
            HouseCat         houseCat         = new HouseCat();
            Jaguar           jaguar           = new Jaguar();

            Console.WriteLine($"channel catfish gets food: {channelCatfish.FoodAquisition()}");
            Console.WriteLine($"flathead catfish habitat: {flatheadCatfish.Habitat}");
            Console.WriteLine($"great white shark cares for young?: {greatWhiteShark.CaresForYoung}");
            Console.WriteLine($"tiger shark move: {tigerShark.FastestMovement()}");
            Console.WriteLine($"emperor penguin swims?: {emperorPenguin.Sing()}");
            Console.WriteLine($"galapagos penguin moves: {galapagosPenguin.FastestMovement()}");
            Console.WriteLine($"mallard sound: {mallard.Sound()}");
            Console.WriteLine($"mandarin duck does barrel roll?: {mandarinDuck.BarrelRoll()}");
            Console.WriteLine($"gyrfalcon does barrel roll?: {gyrfalcon.BarrelRoll()}");
            Console.WriteLine($"prairie falcon sound: {prairieFalcon.Sound()}");
            Console.WriteLine($"dragon does barrel roll?: {dragon.BarrelRoll()}");
            Console.WriteLine($"komodo dragon birth: {komodoDragon.Birth()}");
            Console.WriteLine($" anaconda swims?: {anaconda.Sing()}");
            Console.WriteLine($" rattlesnake gets food: {rattlesnake.FoodAquisition()}");
            Console.WriteLine($"dhole gets food: {dhole.FoodAquisition()}");
            Console.WriteLine($"dhole birth: {dhole.Birth()}");
            Console.WriteLine($"tundra wolf move: {tundraWolf.FastestMovement()}");
            Console.WriteLine($"house cat gets food: {houseCat.FoodAquisition()}");
            Console.WriteLine($"jaguar can climb?: {jaguar.CanClimb}");
        }
Example #8
0
        /// <summary>
        /// This is the method that show case how spcific animal can access interface  IKingOfAnimals.
        /// </summary>
        static void TheInterFace()
        {
            IKingOfAnimals[] king = new IKingOfAnimals[2];


            king[0] = new Lion();
            king[1] = new GreatWhiteShark();

            for (int i = 0; i < king.Length; i++)
            {
                var kingDom = king[i];

                if (kingDom is Lion)
                {
                    var simba = (Lion)kingDom;
                    simba.Hakunamatata();
                }
                else
                {
                    var babyShark = (GreatWhiteShark)kingDom;
                    babyShark.ThemeSong();
                }
            }
        }