private static VhptController CreateVhptController(IVhpt vhpt, EventBroker eventBroker) { var jokeTeller = new JokeTeller(new ModuleController(), new JokeEngine()); jokeTeller.Initialize(); eventBroker.Register(jokeTeller); return new VhptController(vhpt, new ActiveStateMachine<VhptStates, VhptEvents>(), jokeTeller); }
public void ConsumeTellJoke(IVhpt vhpt) { var joke = this.jokeEngine.GetJoke(); vhpt.TellJoke(joke); this.OnToldJoke(); }
public VhptController(IVhpt vhpt, IStateMachine<VhptStates, VhptEvents> stateMachine, JokeTelling.IJokeTeller jokeTeller) { this.vhpt = vhpt; this.stateMachine = stateMachine; this.jokeTeller = jokeTeller; this.vhptIdentification = new VhptIdentification(this.vhpt.Id, this.vhpt.Name); this.RegisterVhptEvents(); this.InitialzeStateMachine(); }
public void TellJoke(IVhpt vhpt) { this.controller.EnqueueMessage(vhpt); }