static void Main(string[] args) { Duck mallard = new MallardDuck(); mallard.PerformQuack(); mallard.PerformFly(); Console.ReadLine(); }
static void Main(string[] args) { // Pato Bravo MallardDuck md = new MallardDuck(); md.Display(); md.Swim(); md.Fly(); md.Quack(); System.Console.WriteLine("\n"); // Pato Cabeça-vermelha RedHeadDuck rhd = new RedHeadDuck(); rhd.Display(); rhd.Swim(); rhd.Fly(); rhd.Quack(); System.Console.WriteLine("\n"); // Pato de Borracha RubberDuck rd = new RubberDuck(); rhd.Display(); rhd.Swim(); rd.Quack(); // Chia invés de grasnar System.Console.WriteLine("\n"); Console.ReadKey(); }
// Code using the template method pattern void flyTheDucks_Click(object sender, EventArgs e) { Duck mallard = new MallardDuck(); mallard.Migrate(); Duck mandarin = new MandarinDuck(); mandarin.Migrate(); }
public void TestMallardDuck() { Duck mallard = new MallardDuck(); Assert.AreEqual("Quack", mallard.Quack()); Assert.AreEqual("I'm flying", mallard.Fly()); }
public void DuckShouldQuack() { var expected = "Quack"; MallardDuck mallardDuck = new MallardDuck(); var result = mallardDuck.Quack(); result.Should().Be(expected); }
static void Main(string[] args) { // Duck var mallard = new MallardDuck(); mallard.PerformQuack(); mallard.PerformFly(); Console.ReadLine(); }
private static void Main() { var mallard = new MallardDuck { Quacker = new QuackNormal() }; mallard.Display(); mallard.Flyer = new FlyWings(); mallard.Display(); }
public static void Main(string[] args) { Duck mallardDuck = new MallardDuck(); mallardDuck.PerformFly(); mallardDuck.PerformQuack(); mallardDuck.SetFlyBehaviour(new RocketFly()); mallardDuck.PerformFly(); }
public void DuckShouldFly() { var expected = "Weeeee"; MallardDuck mallardDuck = new MallardDuck(); var result = mallardDuck.Fly(); result.Should().Be(expected); }
private static void Main(string[] args) { Console.WriteLine("Hello World!"); Duck mallard = new MallardDuck(); mallard.PerformFly(); mallard.PerformQuack(); mallard.SetFlyBehaviour(new FlyNoWay()); mallard.PerformFly(); }
static void Main(string[] args) { Console.WriteLine("Start!"); Duck mallard = new MallardDuck(); mallard.performQuack(); Console.WriteLine("Done!"); Console.WriteLine("Press enter to quit..."); Console.ReadLine(); }
public void TestMallardDuckQuack() { Duck duck = new MallardDuck(); string text = "Quack, quack!\r\n"; using (var consoleOutput = new ConsoleOutput()) { duck.Quack(); Assert.AreEqual(text, consoleOutput.GetOutput()); } Assert.AreEqual(currentConsoleOut, Console.Out); }
private void Start() { MallardDuck duck = new MallardDuck(); WildTurkey turkey = new WildTurkey(); Duck turkeyAdapter = new TurkeyAdapter(turkey); Debug.Log("오리 사용..."); testDuck(duck); Debug.Log("칠면조로 대체..."); testDuck(turkeyAdapter); }
public void MallardDuck() { // Arrange var appConsoleOutput = SetupConsoleOutput(); var mallardDuck = new MallardDuck(); // Act TestDuck(mallardDuck); // Assert ApprovalTests.Approvals.Verify(appConsoleOutput); }
public void DuckAdapterTest() { MallardDuck duck = new MallardDuck(); ITurkey duckAdapter = new DuckAdapter(duck); for (int i = 0; i < 10; i++) { Console.WriteLine("The DuckAdapter says..."); duckAdapter.Gobble(); duckAdapter.Fly(); } }
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(); }
static void Main(string[] args) { // Strategy pattern IQuackable mallardDuck = new MallardDuck(); IQuackable redheadDuck = new RedheadDuck(); IQuackable rubberDuck = new RubberDuck(); duckCall(mallardDuck); duckCall(redheadDuck); duckCall(rubberDuck); Console.ReadKey(); }
public static void Run() { Duck mallard = new MallardDuck(); mallard.PerformQuack(); mallard.PerformFly(); Duck model = new ModelDuck(); model.PerformFly(); model.flyBehavior = new FlyRockedPowered(); model.PerformFly(); }
public static void Test() { Duck mallard = new MallardDuck(); mallard.performQuack(); mallard.performFly(); Duck model = new ModelDuck(); model.performFly(); model.setFlyBehavior(new FlyRocketPowered()); 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(); }
public void TestDuckAdapter() { Duck mallard = new MallardDuck(); Turkey duckAdapter = new DuckAdapter(mallard); Assert.AreEqual("Quack", duckAdapter.Gobble()); Assert.AreEqual("I'm flying", duckAdapter.Fly()); }
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) { Duck mallard = new MallardDuck(); mallard.Quack(); mallard.Fly(); Duck model = new ModelDuck(); model.Fly(); model.Fly = FlyRocketPowered; model.Fly(); }
public static void Main() { Duck mallard = new MallardDuck(); mallard.PerformQuack(); mallard.PerformFly(); Duck model = new ModelDuck(); model.PerformFly(); model.SetFlyBehavior(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(); }
// 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(); }
static void Main(string[] args) { Duck duck = null; duck = new BigYellow(); duck = new MallardDuck(); duck = new RubberDuck(); duck = new SpaceDuck(); duck.display(); duck.fly(); duck.quack(); Console.ReadKey(); }
static void Main(string[] args) { MallardDuck mallardDuck = new MallardDuck(); WildTurkey turkey = new WildTurkey(); TestDuck(mallardDuck); TestTurkey(turkey); IDuck turkeyAdapter = new TurkeyAdapter(turkey); TestDuck(turkeyAdapter); ITurkey duckAdapter = new DuckAdapter(mallardDuck); TestTurkey(duckAdapter); }
static void Main() { MallardDuck duck = new MallardDuck(); WildTurkey turkey = new WildTurkey(); TurkeyAdapter turkeyAdapter = new TurkeyAdapter(turkey); System.Console.WriteLine("The tukey says..."); turkeyAdapter.Quack(); turkeyAdapter.Fly(); System.Console.WriteLine("\nThe Duck says..."); duck.Quack(); duck.Fly(); }
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(); }
public void Start() { logger.Info("Mallard Duck:"); DuckHelper(new MallardDuck()); logger.Info("Spaniel Duck:"); DuckHelper(new SpanielDuck()); logger.Info("Customized Duck:"); var customizedDuck = new MallardDuck(); customizedDuck.SetFly(new FlyHigh()); DuckHelper(new MallardDuck()); }
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 }
public static void Start() { var duck = new MallardDuck(); var turkey = new WildTurkey(); var turkeyLikeDuck = new TurkeyAdapter(turkey); duck.Quack(); duck.Fly(); turkey.Gobble(); turkey.Fly(); turkeyLikeDuck.Quack(); turkeyLikeDuck.Fly(); }
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(); }
private static void Main(string[] args) { var duck = new MallardDuck(); var turkey = new WildTurkey(); var turkeyAdapter = new TurkeyAdapter(turkey); Console.WriteLine("The turkey says..."); turkey.Gobble(); turkey.Fly(); Console.WriteLine("Duck says..."); TestDuck(duck); Console.WriteLine("The turkeyAdapter says..."); TestDuck(turkeyAdapter); Console.ReadLine(); }
public void SetUp() { console = new ConsoleMock(); duck = new MallardDuck(); }
// Adapter pattern void quackTheDucks_Click(object sender, EventArgs e) { List<IQuackable> ducksToQuack = new List<IQuackable>(); // Let's create some ducks - shows the beauty of interfaces MallardDuck mallardDuck = new MallardDuck(); ducksToQuack.Add(mallardDuck); RubberDuck rubberDuck = new RubberDuck(); ducksToQuack.Add(rubberDuck); DuckDecoy duckDecoy = new DuckDecoy(); ducksToQuack.Add(duckDecoy); // Add a goose adapter to show the adapter pattern Goose goose = new Goose(); GooseToDuckAdapter gooseToDuckAdapter = new GooseToDuckAdapter(goose); ducksToQuack.Add(gooseToDuckAdapter); OutputData(ducksToQuack); }