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");
 }