public void SetUp() { _gameService = Substitute.For <IGameService>(); _gameRepository = Substitute.For <IGameRepository>(); _configurationGameRepository = Substitute.For <IConfigurationGameRepository>(); _gameService.StartNewGame().Returns(info => new Tuple <Word, Token> ( WordFactory.GetWord, TokenFactory.GetToken )); _eventDispatcherService = Substitute.For <IEventDispatcherService>(); _startGameUseCase = new StartGameUseCase( _gameService, _gameRepository, _configurationGameRepository, _eventDispatcherService ); }
private void Start() { var mainMenuViewModel = new MainMenuViewModel(); var inGameViewModel = new InGameViewModel(); var loadingViewModel = new LoadingViewModel(); InstantiateViews(mainMenuViewModel, inGameViewModel, loadingViewModel); // TODO: these services should be unique, instantiate it in a previous step var gameRepository = new GameRepository(); var gameServerService = new GameServerService ( new RestRestClientAdapter(new JsonUtilityAdapter()), gameRepository ); var eventDispatcherService = new EventDispatcherService(); var startGameUseCase = new StartGameUseCase(gameServerService, gameRepository, new ConfigurationGameRepository(), eventDispatcherService); var startGameController = new StartGameController(mainMenuViewModel, startGameUseCase ); var keyboardController = new KeyboardController(inGameViewModel, new GuessLetterUseCase( new CheckSolutionUseCase( gameServerService, gameRepository, eventDispatcherService ), gameRepository, gameServerService, eventDispatcherService ) ); var restartGameController = new RestartGameController(inGameViewModel, new RestartGameUseCase(startGameUseCase, eventDispatcherService)); var updateWordPresenter = new InGamePresenter(inGameViewModel, eventDispatcherService); var mainMenuPresenter = new MainMenuPresenter(mainMenuViewModel, eventDispatcherService); var loadingPresenter = new LoadingPresenter(loadingViewModel, eventDispatcherService); }