public async Task NewGame()
        {
            var random = new Random();
            var gameId = random.Next().ToString();
            await Groups.Add(Context.ConnectionId, gameId);

            var game = new Game(gameId);

            var player = new Player(Context.ConnectionId, "P1");
            GameManager.Instance.AddGame(game);
            GameManager.Instance.AddPlayerToGame(gameId, player);

            Clients.Group(gameId).getGameId(gameId);
        }
        public void PlayerOneDrawPlayerTwo()
        {
            var playerOne = new Player("juan");
            var playerTwo = new Player("yagi");

            var shapeOne = new Mock<IShape>();
            shapeOne.Setup(s => s.Defeat(It.IsAny<IShape>())).Returns(true);
            shapeOne.Setup(s => s.ShapeType).Returns(ShapeType.Rock);

            var shapeTwo = new Mock<IShape>();
            shapeTwo.Setup(s => s.Defeat(It.IsAny<IShape>())).Returns(false);
            shapeTwo.Setup(s => s.ShapeType).Returns(ShapeType.Rock);

            playerOne.SelectedShape = shapeOne.Object;
            playerTwo.SelectedShape = shapeTwo.Object;

            var game = new Game();
            var winner = game.Play(playerOne, playerTwo);

            Assert.IsNull(winner);
        }
        public void PlayerTwoWinsPlayerOne()
        {
            var playerOne = new Player("juan");
            var playerTwo = new Player("yagi");

            var shapeThatWins = new Mock<IShape>();
            shapeThatWins.Setup(s => s.Defeat(It.IsAny<IShape>())).Returns(true);
            shapeThatWins.Setup(s => s.ShapeType).Returns(ShapeType.Rock);

            var shapeThatLoses = new Mock<IShape>();
            shapeThatLoses.Setup(s => s.Defeat(It.IsAny<IShape>())).Returns(false);
            shapeThatLoses.Setup(s => s.ShapeType).Returns(ShapeType.Scissor);

            playerOne.SelectedShape = shapeThatLoses.Object;
            playerTwo.SelectedShape = shapeThatWins.Object;

            var game = new Game();
            var winner = game.Play(playerOne, playerTwo);

            Assert.AreEqual(playerTwo, winner);
        }
 public void AddGame(Game game)
 {
     Games.Add(game);
     _players.Add(game.Id, new List<Player>());
 }