Exemplo n.º 1
0
 // 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();
     }
 }
Exemplo n.º 2
0
 /// <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");
 }
Exemplo n.º 3
0
 public void SeabirdSeacraft_TestSpeed()
 {
     seabirdSea.TakeOff();
     Assert.IsTrue((seabirdSea as ISeacraft).Speed > 0);
 }