예제 #1
0
파일: Program.cs 프로젝트: msipe/Patterns
        static void Main(string[] args)
        {
            if (args.Length > 0) {
            switch (args[0]) {
              case "factory":
            var factory = new AbstractFactory();

            Console.WriteLine(factory.CreateMessenger().GiveMessage());
            Console.WriteLine(factory.BuildAnimal("boar").Speak());
            Console.WriteLine(factory.BuildAnimal("lion").Speak());
            Console.WriteLine(factory.BuildAnimal("mouse").Speak());
            Console.WriteLine(factory.BuildAnimal("whale").Speak());
            break;

              case "builder":
            var d = new BuilderDialogue("done");

            while (d.IsEnd() != true) {
              d.RetrieveAnimals();

              if (d.IsEnd()) {
                break;
              }

              d.RetrieveIterations();
              d.SaveSelection();
              d.DisplayAnimals();
            }

            break;

              case "single":
            var msg = Console.ReadLine();

            ILog log = Logger.GetInstance();
            log.Info("hello world");

            Logger.GetInstance().Info("here");
            Logger.Instance.Info("here");
            Logger.Info("here");
            break;

              default:
            Console.WriteLine("Beep Boop");
            break;
            }
              }
              if (args.Length < 1) {
            Console.WriteLine("I am a robot. I am here to take American jobs");
              }
        }
예제 #2
0
 public Client(AbstractFactory factory)
 {
     _abstractProductB = factory.CreateProductB();
     _abstractProductA = factory.CreateProductA();
 }
예제 #3
0
 public Client(AbstractFactory factory)
 {
     _abstractProductB = factory.CreateProductB();
     _abstractProductA = factory.CreateProductA();
 }