// A two-way adapter hides and routes the Target's methods // Use Seacraft instructions to implement this one public void TakeOff() { aircraft.TakeOff(); while (!Airborne) { IncreaseRevs(); } }
/// <summary> /// Experiment 2: Classic usage of an adapter /// </summary> private static void ExecuteExperiment2(IAircraft seabird) { Console.WriteLine("\nExperiment 2: Use the engine in the Seabird"); seabird.TakeOff(); // And automatically increases speed Console.WriteLine("The Seabird took off"); }
public void SeabirdSeacraft_TestSpeed() { seabirdSea.TakeOff(); Assert.IsTrue((seabirdSea as ISeacraft).Speed > 0); }