public void SelectActiveAndOpponentPlayersRandomlyTests()
        {
            var player1Mock = new Mock <IPlayer>();
            var player2Mock = new Mock <IPlayer>();

            player1Mock.SetupProperty(player => player.PlayerNumber, (byte)1);
            player2Mock.SetupProperty(player => player.PlayerNumber, (byte)2);

            (IPlayer activePlayer, IPlayer opponentPlayer)
                = _operations.SelectActiveAndOpponentPlayersRandomly(player1Mock.Object, player2Mock.Object);

            if (activePlayer.PlayerNumber == 1)
            {
                Assert.AreEqual(player1Mock.Object, activePlayer);
            }

            if (activePlayer.PlayerNumber == 2)
            {
                Assert.AreEqual(player2Mock.Object, activePlayer);
            }

            if (opponentPlayer.PlayerNumber == 1)
            {
                Assert.AreEqual(player1Mock.Object, opponentPlayer);
            }

            if (opponentPlayer.PlayerNumber == 2)
            {
                Assert.AreEqual(player2Mock.Object, opponentPlayer);
            }
        }
Example #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="GwentGame"/> class.
        /// </summary>
        public GwentGame(IPlayer player1, IPlayer player2, IGwentGameOperations operations, IGwentGameIO io)
        {
            _operations = operations;
            _io         = io;

            player1.PlayerNumber = 1;
            player2.PlayerNumber = 2;

            (_activePlayer, _opponentPlayer) = _operations.SelectActiveAndOpponentPlayersRandomly(player1, player2);
        }