示例#1
0
        public void Horse_Should_Eat()
        {
            //Arrange
            string expected = "Eating grass...";

            //Act
            var result = _horse.Eat();

            //Assert
            Assert.AreEqual(result, expected);
        }
示例#2
0
        static void Main(string[] args)
        {
            Cat cat = new Cat
            {
                Age  = 45,
                Name = "냥냥이"
            };

            cat.Eat();
            cat.Sleep();
            cat.Sound();
            Console.WriteLine();
            Dog dog = new Dog
            {
                Age  = 15,
                Name = "멍멍이"
            };

            dog.Eat();
            dog.Sleep();
            dog.Sound();
            Console.WriteLine();
            Horse horse = new Horse
            {
                Age  = 5,
                Name = "망망이"
            };

            horse.Eat();
            horse.Sleep();
            horse.Sound();
        }
示例#3
0
        static void Main(string[] args)
        {
            var horse = new Horse {
                Name = "Clippity Clop"
            };

            horse.Speak();
            horse.Eat();

            var cow = new Cow
            {
                Name = "Betsy"
            };

            cow.Speak();
            cow.Eat();
            cow.GiveMilk();

            var chicken = new Chicken
            {
                Name = "Clucky"
            };

            chicken.Speak();
            chicken.Eat();



            Console.ReadLine();
        }
示例#4
0
        static void Main(string[] args)
        {
            Pig Babe = new Pig();

            Babe.sayName("Babe");
            Babe.Speak();
            Babe.Eat();
            Babe.benefit();

            Horse Ed = new Horse();

            Ed.sayName("Mr. Ed to you!");
            Ed.Speak();
            Ed.Eat();
            Ed.benefit();

            Cow Isis = new Cow();

            Isis.sayName("Isis the Goddess");
            Isis.Speak();
            Isis.Eat();
            Isis.benefit();

            Rabbit bugs = new Rabbit();

            bugs.sayName("Sir Bugguswald Bunny");
            bugs.Speak();
            bugs.Eat();
            bugs.benefit();

            Horse SB = new Horse();

            SB.sayName("SeaBiscuit the prize horse!!");
            SB.Speak();
            SB.Eat();
            SB.benefit();

            Rabbit PR = new Rabbit();

            PR.sayName("The young Peter Rabbit");
            PR.Speak();
            PR.Eat();
            PR.benefit();
        }
示例#5
0
        static void Main(string[] args)
        {
            //I created a farm in the Main() method.  I did not include my
            //animal classes.  I couldn't find a way create a messase for
            //namespace that is missing.
            try
            {
                Animal dog = new Animal();
                dog.Speak();

                Horse horse = new Horse();
                horse.Speak();
                horse.Move();
                horse.Action();
                horse.Eat();
                Console.ReadKey();

                Goat goat = new Goat();
                goat.Speak();
                goat.Move();
                goat.Action();
                goat.Eat();
                Console.ReadKey();

                Pig pig = new Pig();
                pig.Speak();
                pig.Move();
                pig.Action();
                pig.Eat();
                Console.ReadKey();

                Chicken chicken = new Chicken();
                chicken.Speak();
                chicken.Move();
                chicken.Action();
                chicken.Eat();
                Console.ReadKey();
            }
            catch (System.Exception e)
            {
                Console.WriteLine(e.Message);
            }
        }
示例#6
0
        static void Main(string[] args)
        {
            Pig Bacon = new Pig();

            Bacon.name = "Bacon";
            Bacon.printbase();
            Bacon.Speak();
            Bacon.Eat();
            Bacon.poop();

            Console.WriteLine();

            Cow Henry = new Cow();

            Henry.name = "Henry";
            Henry.printbase();
            Henry.Speak();
            Henry.Eat();
            Henry.poop();

            Console.WriteLine();

            Horse Stephen = new Horse();

            Stephen.name = "Stephen";
            Stephen.printbase();
            Stephen.Speak();
            Stephen.Eat();
            Stephen.poop();


            Console.WriteLine();

            Chicken Rex = new Chicken();

            Rex.name = "Rex";
            Rex.printbase();
            Rex.Speak();
            Rex.Eat();
            Rex.poop();
        }
示例#7
0
        static void Main(string[] args)
        {
            var address = new AddressBookBuilder();

            address.ActualNumber = 1830;
            address.StreetName   = "Meridain Ave";
            address.LocationName = "South Beach Apt";
            Console.WriteLine(address);
            //
            var oldBoat = new Boat("Trirton", "Outboard Engine type");

            oldBoat.Buy("Frank");
            Console.WriteLine(oldBoat);
            //

            /*var horse = new Animal {Name = "Mr. Ed", FavoriteFood = "Grass",Greeting = "Hello Wilbur"}; //No constructor in class so we set out here.
             * horse.Speak();
             * horse.Eat();*/
            //
            var horse2 = new Horse {
                Name = "Clippity Clop"
            };

            horse2.Speak();
            horse2.Eat();
            horse2.ShoeMyHorse();
            //
            var Betsy = new Cow {
                Name = "Betsy"
            };

            Betsy.Speak();
            Betsy.Eat();
            Betsy.GiveMilk();
            //
            var lancelot  = new Knight();
            var legolas   = new Archer();
            var merlin    = new Wizard();
            var sgtPatton = new RifleSoldier();
            var pvtGump   = new GrenadierSoldier();
            //
            var modernArmy = new List <Soldier>();

            modernArmy.Add(sgtPatton);
            modernArmy.Add(pvtGump);

            modernArmy.ForEach(fighter => fighter.Attack());
            //
            var army = new List <Warrior>();

            army.Add(lancelot);
            army.Add(legolas);
            army.Add(merlin);

            army.ForEach(fighter => fighter.Attack());
            //
            var pegasus1 = new Pegasus(40, 30);

            pegasus1.IncreaseSpeed(20);
            pegasus1.DecreaseSpeed(10);
            pegasus1.FlapWings(10);
            pegasus1.Glide(5);
            Console.WriteLine(pegasus1);
            //
            var car1 = new Car("Volks", "GTI", 210, 25000);

            car1.IncreaseHP(50);
            car1.DecreaseHP(20);
            car1.IncreaseValue(6000);
            car1.DecreaseValue(1000);
            Console.WriteLine(car1);
            //
            var sportsCar1 = new SportsCar("Porsche", "911", 350, 90000);

            sportsCar1.IncreaseHP(50);
            sportsCar1.CustomParts.IncreaseValue(20);


            sportsCar1.IncreaseHpToSportCarLevels();
            Console.WriteLine(sportsCar1);
            //

            Console.ReadLine();
        }