示例#1
0
        static void Main(string[] args)
        {
            BrownBear BoBo   = new BrownBear();
            Peacock   Jane   = new Peacock();
            Goldfish  Bill   = new Goldfish();
            Salmon    Jasper = new Salmon();
            Turtle    Molly  = new Turtle();
            Snake     Kathy  = new Snake();

            Console.WriteLine("Brownbear Speaks: ");
            BoBo.Speak();

            Console.WriteLine("Peacock Sleeps: ");
            Jane.Sleep();
            Console.WriteLine("Peacock interface Play: ");
            Console.WriteLine(Jane.PlayInterface());
            Console.WriteLine("Peacock interface Potty: ");
            Console.WriteLine(Jane.PottyInterface());

            Console.WriteLine("Goldfish Moves: ");
            Bill.Move();
            Console.WriteLine("Goldfish interface Potty: ");
            Console.WriteLine(Bill.PottyInterface());

            Console.WriteLine("Salmon NumOfBabies");
            Jasper.NumOfBabies = 5;
            Console.WriteLine(Jasper.NumOfBabies);

            Console.WriteLine("Turtle HasShell: ");
            Molly.HasShell = true;
            Console.WriteLine(Molly.HasShell);
            Console.WriteLine("Turtle interface Play: ");
            Console.WriteLine(Molly.PlayInterface());

            Console.WriteLine("Snake HasSpine");
            Kathy.HasSpine = true;
            Console.WriteLine(Kathy.HasSpine);

            Console.ReadLine(); //to stop it from auto exit
        }
示例#2
0
        public void TestInterfacePeacock3()
        {
            Peacock George = new Peacock();

            Assert.Equal(10, George.PlayInterface());
        }