public void TestWildTurkey() { Turkey wildTurkey = new WildTurkey(); Assert.AreEqual("Gooble, gooble", wildTurkey.Gobble()); Assert.AreEqual("I'm flying a short distance", wildTurkey.Fly()); }
private static void Main() { var turkey = new WildTurkey(); var adapter = new TurkeyAdapter(turkey); Tester(adapter); }
public static void Main(string[] args) { MallardDuck duck = new MallardDuck(); WildTurkey turkey = new WildTurkey(); IDuck turkeyAdapter = new TurkeyAdapter(turkey); Console.WriteLine("The Turkey says..."); turkey.Gobble(); turkey.Fly(); Console.WriteLine("\nThe Duck says..."); TestDuck(duck); Console.WriteLine("\nThe TurkeyAdapter says..."); TestDuck(turkeyAdapter); ITurkey duckAdapter = new DuckAdapter(duck); Console.WriteLine(""); for (int i = 0; i < 10; i++) { Console.WriteLine("The DuckAdapter says..."); duckAdapter.Gobble(); duckAdapter.Fly(); } }
static void Main(string[] args) { var turkey = new WildTurkey(); var duck = new DuckAdapter(turkey); duck.Sing(); duck.Fly(); }
static void Main(string[] args) { List <DuckBase> ducks = new List <DuckBase>(); DuckBase duck = new MallardDuck(); Turkey turkey = new WildTurkey(); DuckBase turkeyAdaptee = new TurkeyAdapter(turkey); ducks.AddRange(new DuckBase[] { new TurkeyAdapter(new WildTurkey()), new MallardDuck(), duck, turkeyAdaptee }); foreach (var item in ducks) { item.Fly(); item.Quack(); Console.WriteLine("================"); } Console.ReadKey(); }
static void Main(string[] args) { MallardDuck duck = new MallardDuck(); WildTurkey turkey = new WildTurkey(); IDuck turkeyAdapter = new TurkeyAdapter(turkey); Console.WriteLine("\t---Turkey!!!---"); turkey.Fly(); turkey.Gobble(); // Ошибка так как Turkey реализует интерфейс ITurkey //TestDuck(turkey); TestDuck(turkeyAdapter); Console.WriteLine("\n\t---Duck!!!---"); duck.Fly(); duck.Quack(); Console.WriteLine("\t---Turkey!!!---"); TestDuck(turkeyAdapter); Console.WriteLine("\n\t---Duck!!!---"); TestDuck(duck); Console.WriteLine("\n\t---Duck!!!---"); ITurkey duckAdapter = new DuckAdapter(duck); duckAdapter.Fly(); duckAdapter.Gobble(); }
static void Main(string[] args) { IDuck duck = new MallardDuck(); duck.Fly(); duck.Quack(); Console.WriteLine(); ITurkey turkey = new WildTurkey(); turkey.Fly(); turkey.Gobble(); Console.WriteLine(); IDuck adapterDuck = new TurkeyAdapter(turkey); adapterDuck.Fly(); adapterDuck.Quack(); Console.WriteLine(); ITurkey adapterTurkey = new DuckAdapter(duck); adapterTurkey.Fly(); adapterTurkey.Gobble(); Console.ReadKey(); }
static void Main(string[] args) { WildTurkey turkey = new WildTurkey(); Duck turkeyAdapter = new TurkeyAdapter(turkey); turkeyAdapter.quack(); turkeyAdapter.fly(); }
public void Adapter_TurkeyCanQuack() { ITurkey turkey = new WildTurkey(); IDuck adaptedTurkey = new TurkeyAdapter(turkey); var quack = adaptedTurkey.Quack(); Assert.AreEqual("Gobble gobble gobble!", quack); }
static void Main(string[] args) { ITurkey turkey = new WildTurkey(); Duck turkeyAdapter = new TurkeyAdapter(turkey); turkeyAdapter.Display(); turkeyAdapter.Fly(); turkeyAdapter.Quack(); turkeyAdapter.Swim(); }
public void TurkeyShouldGobble() { var expected = "gobble gobble"; WildTurkey wildTurkey = new WildTurkey(); var result = wildTurkey.Gobble(); result.Should().Be(expected); }
static void Main(string[] args) { WildTurkey turkey = new WildTurkey(); IDuck turkeyAdapter = new TurkeyAdapter(turkey); turkey.Gobble(); turkey.Fly(); turkeyAdapter.Quack(); turkeyAdapter.Fly(); }
private void RunAdapterExample() { Duck rubberDuck = new RubberDuck(); ITurkey wildTurkey = new WildTurkey(); TurkeyToDuckAdapter turkey = new TurkeyToDuckAdapter(wildTurkey); turkey.PerformFly(); turkey.PerformQuack(); }
public void AdapterTest() { IDuck mallardDuck = new MallardDuck(); ITurkey turkey = new WildTurkey(); IDuck duck = new TurkeyAdapter(turkey); TestDuck(mallardDuck); TestDuck(duck); }
public void TestTurkeyAdapter() { Turkey wildTurkey = new WildTurkey(); Duck turkeyAdapter = new TurkeyAdapter(wildTurkey); Assert.AreEqual("Gobble, gobble", turkeyAdapter.quack()); Assert.AreEqual("I'm flying a short distance!\n" + "I'm flying a short distance!\n" + "I'm flying a short distance!\n" + "I'm flying a short distance!\n" + "I'm flying a short distance!\n", turkeyAdapter.fly()); }
public void TurkeyShouldFly() { var expected = "flap flap"; WildTurkey wildTurkey = new WildTurkey(); var result = wildTurkey.Fly(); result.Should().Be(expected); }
public void TestAdapter() { var turkey = new WildTurkey(); var adapter = new TurkeyAdapter(turkey); turkey.Fly(); turkey.Gobble(); adapter.Fly(); adapter.Quack(); }
private void Start() { MallardDuck duck = new MallardDuck(); WildTurkey turkey = new WildTurkey(); Duck turkeyAdapter = new TurkeyAdapter(turkey); Debug.Log("오리 사용..."); testDuck(duck); Debug.Log("칠면조로 대체..."); testDuck(turkeyAdapter); }
static void Main(string[] args) { var duck = new MallardDuck(); var turkey = new WildTurkey(); IDuck turkeyAdapter = new TurkeyAdapter(turkey); TestDuck(turkeyAdapter); var uniqObject = Singleton.Singleton.GetInstanse(); }
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) { 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); }
public void TurkeyShouldPassAsDuck() { var expected = "gobble gobble"; WildTurkey turkey = new WildTurkey(); TurkeyAdapter turkeyAdapter = new TurkeyAdapter(turkey); TestDuck(turkeyAdapter); var result = turkeyAdapter.Quack(); result.Should().Be(expected); }
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) { MallardDuck mallard = new MallardDuck(); WildTurkey wild = new WildTurkey(); IDuck turkeyAdapter = new TurkeyAdapter(wild); Console.WriteLine("The Turkey says..."); wild.Gobble(); wild.Fly(); Console.WriteLine("\nThe Duck says..."); TestDuck(mallard); Console.WriteLine("The TurkeyAdapter says..."); TestDuck(turkeyAdapter); }
static void Main(string[] args) { MallardDuck duck = new MallardDuck(); WildTurkey turkey = new WildTurkey(); IDuck fakeTurkey = new TurkeyAdapter(turkey); Console.WriteLine("\n----------Turkey Said-----------\n"); turkey.Gobble(); turkey.Fly(); Console.WriteLine("\n-----------Duck Said---------\n"); TestDuck(duck); Console.WriteLine("\n----------FakeTurkey Said----------\n"); TestDuck(fakeTurkey); }
static void Main(string[] args) { var duck = new MallardDuck(); var turkey = new WildTurkey(); var turkeyAdapter = new TurkeyAdaptor(turkey); Console.WriteLine("The turkey says..."); turkey.Gobble(); turkey.Fly(); Console.WriteLine("\nThe duck says..."); testDuck(duck); Console.WriteLine("\nThe turkey adaptor says..."); testDuck(turkeyAdapter); }
static void Main(string[] args) { MallardDuck duck = new MallardDuck(); WildTurkey turkey = new WildTurkey(); IDuck turkeyAdapter = new TurkeyAdapter(turkey); duck.Quack(); duck.Fly(); turkey.Gobble(); turkey.Fly(); turkeyAdapter.Quack(); turkeyAdapter.Fly(); }
public static void Test() { Duck duck = new MallardDuck(); Turkey turkey = new WildTurkey(); Duck turkeyAdapter = new TurkeyAdapter(turkey); Console.WriteLine("The Turkey says..."); turkey.gobble(); turkey.fly(); Console.WriteLine("\nThe Duck says..."); testDuck(duck); Console.WriteLine("\nThe TurkeyAdapter says..."); testDuck(turkeyAdapter); }
static void Main(string[] args) { MallardDuck duck = new MallardDuck(); WildTurkey turkey = new WildTurkey(); IDuck turkeyAdapter = new TurkeyAdapter(turkey); Console.WriteLine("The Turkey says..."); turkey.Gobble(); turkey.Fly(); Console.WriteLine("\nThe Duck says..."); TestDuck(duck); Console.WriteLine("\nThe TurkeyAdapter says..."); TestDuck(turkeyAdapter); Console.ReadLine(); }
public void TurkeyAdapterTest() { MallardDuck duck = new MallardDuck(); WildTurkey turkey = new WildTurkey(); IDuck turkeyAdapter = new TurkeyAdapter(turkey); Console.WriteLine("The Turkey says..."); turkey.Gobble(); turkey.Fly(); Console.WriteLine($"{Environment.NewLine}The Duck says..."); TestDuck(duck); Console.WriteLine($"{Environment.NewLine}The TurkeyAdapter says..."); TestDuck(turkeyAdapter); }
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(); }