public string Drive()
 {
     if (Age >= 16)
     {
         return(person.Drive());
     }
     return("too young");
 }
        public void TestCase()
        {
            var p = new Person {
                Age = 17
            };
            var rp = new ResponsiblePerson(p);

            Assert.AreNotSame(p.Drink(), rp.Drink());
            Assert.AreSame(p.Drive(), rp.Drive());
            Assert.AreNotSame(p.DrinkAndDrive(), rp.DrinkAndDrive());
        }
예제 #3
0
 public string Drive()
 {
     if (Age > 15)
     {
         return(person.Drive());
     }
     else
     {
         return("too young");
     }
 }
예제 #4
0
 public string Drive()
 {
     return(person.Age < 16 ? "too young" : person.Drive());
 }
예제 #5
0
 public string Drive()
 {
     return(Age >= 16
         ? person.Drive()
         : "too young");
 }