public void VisitorTestCase() { IEngine engine = new StandardEngine(1500); //diagnostics engine.AcceptEngineVisitor(new EngineDiagnostics()); //inventory engine.AcceptEngineVisitor(new EngineInventory()); }
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; }
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); }