Example #1
0
        public void AddingOnePlayerToWaitingQueue()
        {
            var          accessStackWithNew = GetPrivateMethodInfoFor("AccessQueueWithNew");
            const string player1            = "player1";

            Mock <IGameMappable> gameMapperMock = new Mock <IGameMappable>();

            accessStackWithNew.Invoke(null, new Object[] { player1, gameMapperMock.Object });

            Assert.AreEqual(1, WaitingPlayerQueueRef.Count);
            Assert.AreEqual(player1, WaitingPlayerQueueRef.Peek());
        }
Example #2
0
        public void AddingThreePlayersToWaitingQueue()
        {
            var          accessStackWithNew = GetPrivateMethodInfoFor("AccessQueueWithNew");
            const string player1            = "player1";
            const string player2            = "player2";
            const string player3            = "player3";

            Mock <IGameMappable> gameMapperMock = new Mock <IGameMappable>();

            gameMapperMock.Setup(x => x.Add(player1, player2));

            accessStackWithNew.Invoke(null, new Object[] { player1, gameMapperMock.Object });
            accessStackWithNew.Invoke(null, new Object[] { player2, gameMapperMock.Object });
            accessStackWithNew.Invoke(null, new Object[] { player3, gameMapperMock.Object });

            Assert.AreEqual(1, WaitingPlayerQueueRef.Count);
            Assert.AreEqual(player3, WaitingPlayerQueueRef.Peek());
            gameMapperMock.Verify(x => x.Add(player1, player2), Times.Once);
        }
Example #3
0
 public void MyTestInitialize()
 {
     WaitingPlayerQueueRef.Clear();
     Assert.AreEqual(0, WaitingPlayerQueueRef.Count);
 }