Ejemplo n.º 1
0
        public void Test_Adding_2_Players_To_Pool()
        {
            // arrange
            Player p1 = new Player()
            {
                Name = "lorem"
            };
            Player p2 = new Player()
            {
                Name = "ipsum"
            };

            GamePool.FreeGames.Clear();
            GamePool.BusyGames.Clear();

            // act
            GamePool.RegisterPlayer(p1);
            GamePool.RegisterPlayer(p2);

            // assert
            Assert.IsTrue(GamePool.FreeGames.Count == 0);
            Assert.IsTrue(GamePool.BusyGames.Count == 1);

            Game g = GamePool.BusyGames[0];

            Assert.IsNotNull(g);
            Assert.IsTrue(g.Players.Contains(p1));
            Assert.IsTrue(g.Players.Contains(p2));
        }
Ejemplo n.º 2
0
        public void Test_Adding_1_Player_To_Pool()
        {
            // arrange
            Player p1 = new Player()
            {
                Name = "Lorem"
            };

            GamePool.FreeGames.Clear();

            // act
            GamePool.RegisterPlayer(p1);

            // assert
            Assert.IsTrue(GamePool.FreeGames.Count > 0);

            Game g = GamePool.FreeGames.Dequeue();

            Assert.IsNotNull(g);
            Assert.IsTrue(g.Players.Contains(p1));
        }
Ejemplo n.º 3
0
 public static BLL.Models.Game RegisterPlayer(Player p1)
 {
     return(GamePool.RegisterPlayer(p1));
 }