public override void Load() { Bind<IGameDisplay>().To<ConsoleGameDisplay>(); Bind<IMoveStrategy>().To<RandomMoveStrategy>(); Bind<IBoard>().To<Board>(); Bind<PlayGameHandler>().ToMethod(x => { var playGameWelcomeHandler = new PlayGameWelcomeHandler(); var playGameMoveHandler = new PlayGameMoveHandler(new RandomMoveStrategy(), 1000); playGameWelcomeHandler.SetSuccessor(playGameMoveHandler); playGameMoveHandler.SetSuccessor(new PlayGameResultHandler()); return playGameWelcomeHandler; }); }
public void Setup() { _display = new Mock<IGameDisplay>(); _fiveTurnBoard = new Mock<IBoard>(); _moveStrategy = new Mock<IMoveStrategy>(); _fiveTurnBoard.SetupSequence<IBoard, bool>(x => x.IsInPlay()).Returns(true) .Returns(true) .Returns(true) .Returns(true) .Returns(false); _successor = new Mock<PlayGameHandler>(); _playGameMoveHandler = new PlayGameMoveHandler(_moveStrategy.Object, 1); _playGameMoveHandler.SetSuccessor(_successor.Object); }