public void PlayerSetDown_PlayerExist() { ISeat seat = _ISeatCreator(); seat.PlayerSitDown(_player); Assert.Throws <Exception>(() => seat.PlayerSitDown(_player2)); }
public void PlayerSeatDow_yes() { ISeat seat = _ISeatCreator(); seat.DCheckSitDown += delegate { return(true); }; seat.PlayerSitDown(_player); Assert.True(seat.IPlayer == _player); }
public void PlayerSetDown_() { ISeat seat = _ISeatCreator(); seat.PlayerSitDown(_player); Assert.True(seat.IsEmpty == false); Assert.True(seat.IPlayer == _player, "座位玩家Id不对"); }
public void PlayerSeatDow_no() { ISeat seat = _ISeatCreator(); seat.DCheckSitDown += delegate { return(false); }; seat.PlayerSitDown(_player); Assert.False(seat.IPlayer == _player); Assert.True(seat.IsEmpty); }
public void PlayerLeaveSeat() { ISeat seat = _ISeatCreator(); seat.PlayerSitDown(_player); seat.PlayLeave(); Assert.True(seat.IsEmpty == true); Assert.True(seat.IPlayer == null, "座位玩家Id=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); }
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_); }