public void TwoStarts() { InstanceGenerator.Cleaner(CharacteId1); bot.StateMachine(CharacterState.NewCharacter, "/start", CharacteId1); bot.StateMachine(CharacterState.NewCharacter, "/start", CharacteId1); Assert.AreEqual(_characterRepository.Read(CharacteId1).State, CharacterState.ChangeName); }
public void FindGame() { InstanceGenerator.Cleaner(CharacteId1); bot.StateMachine(CharacterState.NewCharacter, "/start", CharacteId1); bot.StateMachine(_characterRepository.Read(CharacteId1).State, "Step1", CharacteId1); bot.StateMachine(_characterRepository.Read(CharacteId1).State, "/game", CharacteId1); Assert.AreEqual(_characterRepository.Read(CharacteId1).State, CharacterState.FindGame); }
public void SetUserName() { InstanceGenerator.Cleaner(CharacteId1); bot.StateMachine(CharacterState.NewCharacter, "/start", CharacteId1); bot.StateMachine(_characterRepository.Read(CharacteId1).State, "Step1", CharacteId1); Assert.AreEqual(_characterRepository.Read(CharacteId1).CharacterName, "Step1"); Assert.AreEqual(_characterRepository.Read(CharacteId1).State, CharacterState.ChangeGameMode); }
public void MoveToHospital() { InstanceGenerator.Cleaner(CharacteId1); CreateChar(CharacteId1, lobbyId, "Step1"); CreateChar(CharacteId2, lobbyId, "Step2"); Lobby newlobby = InstanceGenerator.GenerateTestingLobby(lobbyId); _lobbyRepository.Create(newlobby); bot.StateMachine(_characterRepository.Read(CharacteId1).State, "Влево", CharacteId1); newlobby = _lobbyRepository.Read(lobbyId); Assert.AreEqual(newlobby.Players[0].Health == LobbyRules.Test().PlayerMaxHealth, true); }
public void BombinVoid() { InstanceGenerator.Cleaner(CharacteId1); CreateChar(CharacteId1, lobbyId, "Step1"); CreateChar(CharacteId2, lobbyId, "Step2"); Lobby newlobby = InstanceGenerator.GenerateTestingLobby(lobbyId); _lobbyRepository.Create(newlobby); bot.BComm(CharacteId1, Direction.North); newlobby = _lobbyRepository.Read(lobbyId); Assert.AreEqual(newlobby.Maze[2, 1] == 0, true); Assert.AreEqual(newlobby.Players[0].Bombs == LobbyRules.Test().PlayerMaxBombs - 1, true); }
public void ShootInPlayer() { InstanceGenerator.Cleaner(CharacteId1); CreateChar(CharacteId1, lobbyId, "Step1"); CreateChar(CharacteId2, lobbyId, "Step2"); Lobby newlobby = InstanceGenerator.GenerateTestingLobby(lobbyId); _lobbyRepository.Create(newlobby); bot.SComm(CharacteId1, Direction.North); newlobby = _lobbyRepository.Read(lobbyId); Assert.AreEqual(newlobby.Players[1].Health == LobbyRules.Test().PlayerMaxHealth - 1, true); Assert.AreEqual(newlobby.Players[0].Guns == LobbyRules.Test().PlayerMaxGuns - 1, true); }
public void MoveUp() { InstanceGenerator.Cleaner(CharacteId1); CreateChar(CharacteId1, lobbyId, "Step1"); CreateChar(CharacteId2, lobbyId, "Step2"); Lobby newlobby = InstanceGenerator.GenerateTestingLobby(lobbyId); _lobbyRepository.Create(newlobby); bot.StateMachine(_characterRepository.Read(CharacteId1).State, "Вверх", CharacteId1); newlobby = _lobbyRepository.Read(lobbyId); Assert.AreEqual(newlobby.Players[0].UserCoordinate.X == 2, true); Assert.AreEqual(newlobby.Players[0].UserCoordinate.Y == 1, true); }
public void StabInPlayer() { InstanceGenerator.Cleaner(CharacteId1); CreateChar(CharacteId1, lobbyId, "Step1"); CreateChar(CharacteId2, lobbyId, "Step2"); Lobby newlobby = InstanceGenerator.GenerateTestingLobby(lobbyId); _lobbyRepository.Create(newlobby); bot.StateMachine(_characterRepository.Read(CharacteId1).State, "Пропуск хода", CharacteId1); bot.StateMachine(_characterRepository.Read(CharacteId2).State, "Вниз", CharacteId2); bot.StateMachine(_characterRepository.Read(CharacteId1).State, "Удар кинжалом", CharacteId1); newlobby = _lobbyRepository.Read(lobbyId); Assert.AreEqual(newlobby.Players[1].Health == LobbyRules.Test().PlayerMaxHealth - 1, true); }
public void CheckLobby() { InstanceGenerator.Cleaner(CharacteId1); bot.StateMachine(CharacterState.NewCharacter, "/start", CharacteId1); bot.StateMachine(_characterRepository.Read(CharacteId1).State, "Step1", CharacteId1); bot.StateMachine(_characterRepository.Read(CharacteId1).State, "/game", CharacteId1); bot.StateMachine(CharacterState.NewCharacter, "/start", CharacteId2); bot.StateMachine(_characterRepository.Read(CharacteId2).State, "Step2", CharacteId2); bot.StateMachine(_characterRepository.Read(CharacteId2).State, "/game", CharacteId2); int lobbyId = _memberRepository.ReadLobbyId(CharacteId1); Lobby lobby = _lobbyRepository.Read(lobbyId); Assert.AreEqual(lobby.Players.Count, 2); Assert.AreEqual(lobby.Players[0].TelegramUserId, CharacteId1); Assert.AreEqual(lobby.Players[1].TelegramUserId, CharacteId2); Assert.AreEqual(lobby.IsActive, true); }
public void ReadTest() { int lobbyId = 1; InstanceGenerator.Cleaner(lobbyId); var lobby = InstanceGenerator.GenerateTestingLobby(lobbyId); LobbyRepository lobbyRepository = new LobbyRepository(); lobbyRepository.Create(lobby); var newLobby = lobbyRepository.Read(lobbyId); Assert.AreEqual(lobby.GameId, newLobby.GameId); Assert.AreEqual(lobby.Maze[0, 3], newLobby.Maze[0, 3]); Assert.AreEqual(lobby.Players.Count, newLobby.Players.Count); }