Ejemplo n.º 1
0
 public void VisitorTestCase()
 {
     IEngine engine = new StandardEngine(1500);
     //diagnostics
     engine.AcceptEngineVisitor(new EngineDiagnostics());
     //inventory
     engine.AcceptEngineVisitor(new EngineInventory());
 }
Ejemplo n.º 2
0
 public virtual IEngine GetTurboEngine(int size)
 {
     IEngine engine;
     var found = _turboEnginePool.TryGetValue(size, out engine);
     if (found) return engine;
     engine = new StandardEngine(size);
     _turboEnginePool[size] = engine;
     return engine;
 }
Ejemplo n.º 3
0
        public void AdapterTestCase()
        {
            var engine1 = new StandardEngine(1200);
            var engine2 = new SuperGreenEngine(1500);
            var adapter = new SuperGreenEngineAdapter(engine2);

            //Log
            Console.WriteLine(engine1.ToString());
            Console.WriteLine(engine2.ToString());
            Console.WriteLine(adapter.ToString());
            Assert.IsInstanceOf<IEngine>(adapter);
        }