static void Main(string[] args) { Duck mallard = new MallardDuck(); mallard.PerformQuack(); mallard.PerformFly(); Console.ReadLine(); }
public static void Main(string[] args) { Duck mallardDuck = new MallardDuck(); mallardDuck.PerformFly(); mallardDuck.PerformQuack(); mallardDuck.SetFlyBehaviour(new RocketFly()); mallardDuck.PerformFly(); }
private static void Main(string[] args) { Console.WriteLine("Hello World!"); Duck mallard = new MallardDuck(); mallard.PerformFly(); mallard.PerformQuack(); mallard.SetFlyBehaviour(new FlyNoWay()); mallard.PerformFly(); }
public static void Test_1() { var mallardDuck = new MallardDuck(); mallardDuck.Display(); mallardDuck.PerformFly(); mallardDuck.SetFlyBehavior(new FlyNoWay()); mallardDuck.PerformFly(); mallardDuck.PerformQuack(); mallardDuck.SetFlyBehavior(new FlyLikeRocket()); mallardDuck.PerformFly(); }
// Use this for initialization void Start() { Duck millard = new MallardDuck(); millard.PerformQuack(); millard.PerformFly(); millard.SetFlyBehavior(new FlyNoWay()); millard.SetQuackBehavior(new MuteQuack()); millard.PerformQuack(); millard.PerformFly(); }
public void DuckSimulatorTest() { var mallardDuck = new MallardDuck(new FlyWithWings(), new Quack()); mallardDuck.Display(); mallardDuck.PerformFly(); mallardDuck.PerformQuack(); //Dynamically change behavior mallardDuck.ChangeFlyBehaviour(new FlyRocketPower()); mallardDuck.PerformFly(); Assert.True(true); }
public void MiniDuckSimulator() { Duck mallard = new MallardDuck(); mallard.Display(); mallard.PerformFly(); mallard.PerformQuack(); Duck model = new ModelDuck(); mallard.Display(); mallard.PerformFly(); model.SetFlyBehavior(new FlyRocketPowered()); mallard.PerformQuack(); }
private static void Main() { var mallardDuck = new MallardDuck(); mallardDuck.Display(); mallardDuck.PerformQuack(); mallardDuck.Swim(); mallardDuck.PerformFly(); Console.WriteLine(); var redheadDuck = new RedheadDuck(); redheadDuck.Display(); redheadDuck.PerformQuack(); redheadDuck.Swim(); redheadDuck.PerformFly(); Console.WriteLine(); var rubberDuck = new RubberDuck(); rubberDuck.Display(); rubberDuck.PerformQuack(); rubberDuck.Swim(); rubberDuck.PerformFly(); Console.WriteLine(); var decoyDuck = new DecoyDuck(); decoyDuck.Display(); decoyDuck.Swim(); Console.WriteLine(); Console.Write("Press Enter to exit ..."); Console.ReadLine(); }
public static void Start() { Duck mallard = new MallardDuck(new FlyWithWings(), new SimpleQuack()); mallard.PerformQuack(); mallard.PerformFly(); }
public void mainTest() { Duck mallard = new MallardDuck(); mallard.PerformFly(); mallard.PerformQuack(); }
static void Main(string[] args) { Console.WriteLine("Game"); Character character = new King(); character.SetWeapon(new Knife()); character.Fight(); character.SetWeapon(new BowAndArrow()); character.Fight(); Console.WriteLine("\nDuck"); Duck mallard = new MallardDuck(); mallard.PerformFly(); mallard.PerformQuack(); Duck model = new ModelDuck(); model.PerformFly(); model.SetFlyBehavior(new FlyRocketPowered()); model.PerformFly(); Console.ReadKey(); }
public void MallardDuckTest() { Duck mallard = new MallardDuck(); Assert.Equal("I'm flying!", mallard.PerformFly()); Assert.Equal("Quack!", mallard.PerformQuack()); }
public void MarllardDuckTest() { var duck = new MallardDuck(); duck.PerformFly(); duck.PerformQuack(); duck.Display(); }
static void Main(string[] args) { Duck mallard = new MallardDuck(); mallard.Swim(); mallard.PerformQuack(); mallard.PerformFly(); }
public void TestMallardDuck() { HeadFirstDesignPatterns.Strategy.Duck.Duck Mallard = new MallardDuck(); Assert.AreEqual("Quack", Mallard.PerformQuack()); Assert.AreEqual("I'm flying!!", Mallard.PerformFly()); }
static void Main(string[] args) { System.Console.WriteLine("Hello World!"); Duck mallard = new MallardDuck(); mallard.PerformQuack(); mallard.PerformFly(); }
static void Main(string[] args) { // Duck var mallard = new MallardDuck(); mallard.PerformQuack(); mallard.PerformFly(); Console.ReadLine(); }
public static void Main() { Duck mallard = new MallardDuck(); mallard.PerformQuack(); mallard.PerformFly(); Duck model = new ModelDuck(); model.PerformFly(); model.SetFlyBehavior(new FlyRocketPowered()); model.PerformFly(); }
public static void Start() { var mallard = new MallardDuck(); mallard.PerformQuack(); mallard.PerformFly(); var model = new ModelDuck(); model.PerformFly(); model.FlyBehavior = new FlyRocketPowered(); model.PerformFly(); }
static void Main(string[] args) { Console.WriteLine("Create Mallard Duck"); Console.WriteLine(); Duck duck = new MallardDuck(); duck.Display(); duck.PerformQuack(); duck.PerformFly(); duck.Swim(); Console.WriteLine(); Console.WriteLine("Change the state"); Console.WriteLine(); duck.SetFlyBehavior(new FlyRocketPowered()); duck.SetQuackBehavior(new MuteQuack()); duck.Display(); duck.PerformQuack(); duck.PerformFly(); duck.Swim(); }
public static void Run() { Duck mallard = new MallardDuck(); mallard.PerformQuack(); mallard.PerformFly(); Duck model = new ModelDuck(); model.PerformFly(); model.flyBehavior = new FlyRockedPowered(); model.PerformFly(); }
static void Main(string[] args) { Duck mallard = new MallardDuck(); mallard.PerformQuack(); mallard.PerformFly(); Duck model = new ModelDuck(); model.PerformFly(); model.SetFlyBehavior(new Implementations.FlyRocketPower()); model.PerformFly(); }
public void Test2() { Duck mallard = new MallardDuck(); mallard.PerformQuack(); mallard.PerformFly(); Duck model = new ModelDuck(); model.PerformFly(); model.FlyBehavior = new FlyRocketPowered(); model.PerformFly(); }
static void Main(string[] args) { Duck mallard = new MallardDuck(); mallard.PerformQuack(); mallard.PerformFly(); Duck model = new ModelDuck(); model.PerformFly(); model.SetFlyBehaviour(new FlyRocketPowered()); model.PerformFly(); }
static void Main(string[] args) { Console.WriteLine("Simulador de patos"); Console.WriteLine("------------------"); Duck mallard = new MallardDuck(); Console.WriteLine(mallard.PerformQuack()); Console.WriteLine(mallard.PerformFly()); Duck model = new ModelDuck(); Console.WriteLine(model.PerformFly()); }
static void Main(string[] args) { Duck mallard = new MallardDuck(); mallard.PerformQuack(); mallard.PerformFly(); mallard.Display(); Console.WriteLine(); Duck model = new ModelDuck(); model.PerformFly(); model.SetFlyBehavior(new FlyRocketPowered()); model.PerformFly(); }
static void Main(string[] args) { var mallard = new MallardDuck(); mallard.Display(); mallard.PerformFly(); mallard.PerformQuack(); var modelDuck = new ModelDuck(); modelDuck.PerformFly(); modelDuck.SetFlyBehavior(new FlyRocketPowered()); modelDuck.PerformFly(); Console.ReadKey(true); }
static void Main(string[] args) { Duck duck = new MallardDuck(); duck.PerformQuack(); duck.PerformFly(); duck = new ModelDuck(); duck.PerformFly(); duck.DuckFlyBehavior = new FlyRocketPowered(); duck.PerformFly(); Console.ReadLine(); // So the console window doesn't close immediately }
static void Main(string[] args) { var mallard = new MallardDuck(); mallard.PerformFly(); mallard.PerformQuack(); mallard.Display(); mallard.Swim(); var modelDuck = new ModelDuck(); modelDuck.Display(); modelDuck.PerformFly(); modelDuck.FlyBehaviour = new FlyRocketPowered(); modelDuck.PerformFly(); Console.ReadLine(); }
public static void Main(string[] args) { Duck mallard = new MallardDuck(); mallard.PerformQuack(); mallard.PerformFly(); Duck model = new ModelDuck(); model.PerformFly(); model.FlyBehavior = new FlyRocketPowered(); model.PerformFly(); IQuackBehavior duckCall = new DuckCall(); duckCall.quack(); }
static void Main(string[] args) { Duck duck = new MallardDuck(); duck.Display(); duck.PerformFly(); duck.PerformQuack(); Duck model = new DecoyDuck(); model.Display(); model.PerformFly(); model.SetFlyBehavior(new FlyWithWings()); model.PerformFly(); Console.ReadLine(); }
static void Main() { var mallard = new MallardDuck(); mallard.PerformQuack(); mallard.PerformFly(); Console.WriteLine(); Console.WriteLine("--- Dynamic behavior ---"); var model = new ModelDuck(); model.PerformFly(); model.SetFlyBehavior(new FlyRocketPowered()); model.PerformFly(); Console.ReadKey(); }
static void Main(string[] args) { IFlyBehavior flyBehavior = new FlyBehavior.FlyBehavior(); IQuackBehavior quackBehavior = new QuackBehavior.QuackBehavior(); MallardDuck mallardDuck = new MallardDuck(quackBehavior, flyBehavior); mallardDuck.PerformFly(); mallardDuck.PerformQuack(); IFlyBehavior flyBehaviorNoFly = new FlyNoWayBehavior(); IQuackBehavior quackBehaviorNoQuack = new MuteQuackBehavior(); MallardDuck mallardDuckSpecial = new MallardDuck(quackBehaviorNoQuack, flyBehaviorNoFly); mallardDuckSpecial.PerformFly(); mallardDuckSpecial.PerformQuack(); }
static void Main(string[] args) { Duck mallard = new MallardDuck(); mallard.PerformQuack(); mallard.PerformFly(); Duck model = new ModelDuck(); model.PerformQuack(); model.PerformFly(); model.FlyBehavior = new FlyRocketPowered(); model.PerformFly(); Console.ReadKey(); // Go to http://aka.ms/dotnet-get-started-console to continue learning how to build a console app! }