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");
     }
 }
 public string Drive()
 {
     return(person.Age < 16 ? "too young" : person.Drive());
 }
示例#5
0
 public string Drive()
 {
     return(Age >= 16
         ? person.Drive()
         : "too young");
 }