示例#1
0
        public void PlayerSetDown_PlayerExist()
        {
            ISeat seat = _ISeatCreator();

            seat.PlayerSitDown(_player);

            Assert.Throws <Exception>(() => seat.PlayerSitDown(_player2));
        }
示例#2
0
        public void PlayerSeatDow_yes()
        {
            ISeat seat = _ISeatCreator();

            seat.DCheckSitDown += delegate { return(true); };
            seat.PlayerSitDown(_player);

            Assert.True(seat.IPlayer == _player);
        }
示例#3
0
        public void PlayerSetDown_()
        {
            ISeat seat = _ISeatCreator();

            seat.PlayerSitDown(_player);

            Assert.True(seat.IsEmpty == false);
            Assert.True(seat.IPlayer == _player, "座位玩家Id不对");
        }
示例#4
0
        public void PlayerSeatDow_no()
        {
            ISeat seat = _ISeatCreator();

            seat.DCheckSitDown += delegate { return(false); };
            seat.PlayerSitDown(_player);

            Assert.False(seat.IPlayer == _player);
            Assert.True(seat.IsEmpty);
        }
示例#5
0
        public void PlayerLeaveSeat()
        {
            ISeat seat = _ISeatCreator();

            seat.PlayerSitDown(_player);
            seat.PlayLeave();

            Assert.True(seat.IsEmpty == true);
            Assert.True(seat.IPlayer == null, "座位玩家Id=0");
        }
示例#6
0
        /// <summary>
        /// 添加座位坐下
        /// </summary>
        /// <param name="player">玩家</param>
        /// <returns>座位</returns>
        public ISeat PlaySitDown(IPlayerJoinRoom player)
        {
            ISeat seat = GetOneEmptySeat();

            if (seat == null)
            {
                seat = AddSet(1);
            }
            seat.PlayerSitDown(player);
            return(seat);
        }
示例#7
0
        public void PlayerSeatDown_beforEvent()
        {
            ISeat seat = _ISeatCreator();
            bool  beforSitDownEvent_ = false;
            bool  afterSitDownEvent_ = false;

            seat.BeforSitDownHandler += delegate { beforSitDownEvent_ = true; };
            seat.AfterSitDownHandler += delegate { afterSitDownEvent_ = true; };
            seat.PlayerSitDown(_player);

            Assert.True(beforSitDownEvent_);
            Assert.True(afterSitDownEvent_);
        }