示例#1
0
文件: Program.cs 项目: Bigrig72/Zoo
        public static bool CreatePegicorn()
        {
            Console.ForegroundColor = ConsoleColor.Magenta;
            try
            {
                Console.WriteLine("Name the Zoo's Pegacorn:");
                string name = Console.ReadLine();

                Console.WriteLine("What is the pegacorn's super power?");
                string superPower = Console.ReadLine();

                Pegacorn pegacorn = new Pegacorn(superPower, name);
                int      speed    = pegacorn.FlightSpeed();
                bool     attack   = pegacorn.Attack();
                bool     heal     = pegacorn.Heal();

                Console.ReadKey();
                return(true);
            }
            catch (Exception ex)
            {
                Console.WriteLine($"Pegicorn - Exception thrown: {ex.Message}");
                return(false);
            }
        }
示例#2
0
        public void PegacornInterface()
        {
            string superPower = "Speed flight";
            // string superPower2 = "healer";
            string name = "aldo";

            Pegacorn pega = new Pegacorn(superPower, name);

            Assert.IsAssignableFrom <IFly>(pega);
        }
示例#3
0
        // Checking to see if Override works, pegacorn will have a specific attack
        public void PegacornOverrideAttack()
        {
            string superPower = "Speed flight";
            // string superPower2 = "healer";
            string name = "aldo";

            Pegacorn pega = new Pegacorn(superPower, name);

            pega.Attack();
            Assert.Equal(pega.Attack(), pega.Attack());
            Assert.IsAssignableFrom <IFly>(pega);
        }
示例#4
0
        // Checking to see if Override works, pegacorn will have a specific name
        public void PegacornOverrideName()
        {
            string superPower = "Speed flight";
            // string superPower2 = "healer";
            string name = "aldo";

            Pegacorn pega = new Pegacorn(superPower, name);

            // Pegacorn Override Name to change name
            Assert.Equal("aldo", "aldo");
            Assert.IsAssignableFrom <IFly>(pega);
        }