public Player ProcessResult(Player playerOne, Player playerTwo, out string output)
        {
            Shape playerOneShape = playerOne.OutputShapes.Last().Value;
            Shape playerTwoShape = playerTwo.OutputShapes.Last().Value;

            if (playerOneShape == playerTwoShape)
            {
                // no win, both equal
                output = "Draw, Both Lose!";
                return null;
            }

            if ((int)playerTwoShape % 3 + 1 == (int)playerOneShape)
            {
                output = playerOne.Name + " Wins!";
                playerOne.Score += 1;

                return playerOne;
            }

            if ((int)playerOneShape % 3 + 1 == (int)playerTwoShape)
            {
                output = playerTwo.Name + " Wins!";
                playerTwo.Score += 1;

                return playerTwo;
            }

            throw new Exception("Failed to ProcessResult");
        }
        public Shape Play(Player player, int counter, Shape selectedShape = Shape.Unknown)
        {
            if (player == null)
            {
                throw new NullReferenceException("Player cannot be null");
            }

            Shape outputShape;

            if (player.PlayerType == PlayerType.Player)
            {
                outputShape = selectedShape;
            }
            else
            {
                // computer player
                int randomNumber = _random.Next(1, 4);

                outputShape = (Shape)randomNumber;
            }

            player.OutputShapes.Add(counter, outputShape);

            return outputShape;
        }
        public void Setup()
        {
            _playerOne = new Player { Name = "Player", PlayerType = PlayerType.Player };

            _playerTwo = new Player { Name = "Computer", PlayerType = PlayerType.Computer };

            _playService = new PlayService();
        }
        public void When_Player_against_Computer_Select_Shape_Test()
        {
            // act
            var playerOne = new Player
            {
                PlayerType = PlayerType.Player
            };

            var playerTwo = new Player
            {
                PlayerType = PlayerType.Computer
            };

            IPlayService playService = new PlayService();

            // actual
            var playerOneActual = playService.Play(playerOne, 1, Shape.Paper);
            var playerTwoActual = playService.Play(playerTwo, 1);

            // assert
            Assert.AreEqual(playerOneActual, Shape.Paper);
            Assert.IsNotNull(playerTwoActual);
        }
 public void Cleanup()
 {
     _playerOne = null;
     _playerTwo = null;
     _playService = null;
 }