public GameBoardViewModel PlayGame(Move playerMove)
        {
            var generatedMove = _computerMoveGenerator.GenerateComputerMove();

            var result = _gameResolver.ResolveGame(playerMove, generatedMove);

            return new GameBoardViewModel(result);
        }
        public void GameServicePassesMoveFromPlayerToGameResolver()
        {
            var playerMove = new Move();

            var classUnderTest = BuildUpClassUnderTest();

            classUnderTest.PlayGame(playerMove);

            Assert.That(_move1PassedToResolver, Is.SameAs(playerMove));
        }
        public void WhenResultIsDrawConfiguresViewAsDraw()
        {
            _moveToReturnFromMoveGenerator = new Move();
            _gameResultToReturnFromResolver = new DrawnGame(string.Empty);

            var classUnderTest = BuildUpClassUnderTest();

            var result = classUnderTest.PlayGame(new Move());

            Assert.That(result.IsDraw, Is.True);
        }
        public void GameServicePassesMoveFromMoveGeneratorToGameResolver()
        {
            _moveToReturnFromMoveGenerator = new Move();
            _gameResultToReturnFromResolver = new FakeGameResult();

            var classUnderTest = BuildUpClassUnderTest();

            classUnderTest.PlayGame(new Move());

            Assert.That(_move2PassedToResolver, Is.SameAs(_moveToReturnFromMoveGenerator));
        }
        public void BuildsCorrectlyFromAWinGame()
        {
            var winninMove = new Move();
            var losingMove = new Move();
            const string winSummary = "Win";

            var result = new WinGame(winninMove, losingMove, winSummary);

            var classUnderTest = new GameBoardViewModel(result);

            Assert.That(classUnderTest.WinnerMove, Is.SameAs(winninMove));
            Assert.That(classUnderTest.LosingMove, Is.SameAs(losingMove));
            Assert.That(classUnderTest.ResultText, Is.EqualTo(winSummary));
            Assert.That(classUnderTest.IsDraw, Is.False);
        }
 public void GivenTheComputerWillPayScissors(Weapon weaponType)
 {
     ComputerMove = new Move() { PlayerName = "Computer", WeaponType = weaponType };
 }
 public void GivenPlaysRock(string playerName, Weapon weaponType)
 {
     PlayerMove = new Move() {PlayerName = playerName, WeaponType = weaponType};
 }
 public GameBoardViewModel PlayGame(Move playerMove)
 {
     _movedPassedToGameService = playerMove;
     return _responseFromGameService;
 }
 public GameResult ResolveGame(Move move1, Move move2)
 {
     _move1PassedToResolver = move1;
     _move2PassedToResolver = move2;
     return _gameResultToReturnFromResolver;
 }
 private Move GenerateMove(Weapon weaponType)
 {
     var move = new Move() { PlayerName = "Player1", WeaponType = weaponType};
     return move;
 }