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()); }
public string Drive() { if (Age > 15) { return(person.Drive()); } else { return("too young"); } }
public string Drive() { return(person.Age < 16 ? "too young" : person.Drive()); }
public string Drive() { return(Age >= 16 ? person.Drive() : "too young"); }