static void TestDucksQuacking() { var countingDuckFactory = new CountingDuckFactory(); var duckFactory = new DuckFactory(); IQuackable mallarDuck; IQuackable duckCallDuck; IQuackable fakeDuckIsAGoose; IQuackable rubberDuck; IQuackable redheadDuck; var flock = new Flock(); CreateDucks(countingDuckFactory, out mallarDuck, out duckCallDuck, out fakeDuckIsAGoose, out rubberDuck, out redheadDuck); flock.addQuackable(mallarDuck); flock.addQuackable(duckCallDuck); flock.addQuackable(fakeDuckIsAGoose); flock.addQuackable(rubberDuck); flock.addQuackable(redheadDuck); SimulateQuacks(redheadDuck, duckCallDuck, fakeDuckIsAGoose, mallarDuck, rubberDuck); flock.quack(); Console.WriteLine("Number of Quacks: {0}", QuackCounter.getQuacks()); CreateDucks(duckFactory, out mallarDuck, out duckCallDuck, out fakeDuckIsAGoose, out rubberDuck, out redheadDuck); flock.addQuackable(mallarDuck); flock.addQuackable(duckCallDuck); flock.addQuackable(fakeDuckIsAGoose); flock.addQuackable(rubberDuck); flock.addQuackable(redheadDuck); flock.quack(); flock.quack(); flock.quack(); flock.quack(); SimulateQuacks(redheadDuck, duckCallDuck, fakeDuckIsAGoose, mallarDuck, rubberDuck); Console.WriteLine("Number of Quacks: {0}", QuackCounter.getQuacks()); Console.ReadKey(); }