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