public void FullShortGameTest() { var mockCircleRepository = new MockCircleRepository(); var mockGameRepository = new MockGameRepository(); var mockPhraseRepository = new MockPhraseRepository(); var mockRandomProvider = new MockRandomProvider(); mockCircleRepository.Circle = GetCircle(); mockPhraseRepository.Phrase = "Short Game Test"; const int indexOneThousand = 7; mockRandomProvider.Values.Add((0, 13), indexOneThousand); var startNewGamePresenter = new Presenter <StartNewGame.ResponseModel>(); var startNewGameInteractor = new StartNewGame(mockPhraseRepository, mockGameRepository); startNewGameInteractor.HandleRequest(new StartNewGame.RequestModel() { PlayerNames = new string[] { "Alice", "Bob", "Charlie" } }, startNewGamePresenter); var spinCirclePresenter = new Presenter <SpinCircle.ResponseModel>(); var spinCircleInteractor = new SpinCircle(mockGameRepository, mockCircleRepository, mockRandomProvider); spinCircleInteractor.HandleRequest(new SpinCircle.RequestModel() { GameIdentifier = startNewGamePresenter.ResponseModel.GameIdentifier }, spinCirclePresenter); var pickLetterPresenter = new Presenter <PickLetter.ResponseModel>(); var pickLetterInteractor = new PickLetter(mockGameRepository); pickLetterInteractor.HandleRequest(new PickLetter.RequestModel() { GameIdentifier = startNewGamePresenter.ResponseModel.GameIdentifier, Letter = 'e' }, pickLetterPresenter); var guessPhrasePresenter = new Presenter <GuessPhrase.ResponseModel>(); var guessPhraseInteractor = new GuessPhrase(mockGameRepository); guessPhraseInteractor.HandleRequest(new GuessPhrase.RequestModel() { GameIdentifier = startNewGamePresenter.ResponseModel.GameIdentifier, Guess = "Short Game Test" }, guessPhrasePresenter); Assert.Equal("Short Game Test", guessPhrasePresenter.ResponseModel.Phrase); Assert.Equal("Alice", guessPhrasePresenter.ResponseModel.CurrentPlayerName); Assert.Equal(2000, guessPhrasePresenter.ResponseModel.Reward); Assert.True(mockGameRepository.Games.Single().Value.IsOver); }
public void WhenGuessCorrect_RespondsCorrectly() { var mockGameRepository = new MockGameRepository(); var interactor = new GuessPhrase(mockGameRepository); var gameIdentifier = Guid.Parse("00000000-0000-0000-0000-000000000001"); var game = new Game(new string[] { "Alice", "Bob" }, "TestPhrase"); game.HandleSpace(new CircleSpace(CircleSpace.SpaceType.Dollar, 1600)); game.HandleLetter('e'); mockGameRepository.Games.Add(gameIdentifier, game); var requestModel = new GuessPhrase.RequestModel() { GameIdentifier = gameIdentifier, Guess = "TestPhrase" }; var presenter = new Presenter <GuessPhrase.ResponseModel>(); interactor.HandleRequest(requestModel, presenter); var responseModel = presenter.ResponseModel; Assert.Equal("TestPhrase", responseModel.Phrase); Assert.Equal("Alice", responseModel.CurrentPlayerName); Assert.Equal(3200, responseModel.Reward); }