12345678910111213141516171819202122232425262728293031323334353637383940 |
- using System.Collections.Generic;
- using System.Threading.Tasks;
- using MafiaTelegramBot.Game;
- using MafiaTelegramBot.Game.GameRoles;
- using MafiaTelegramBot.Game.GameRooms;
- using MafiaTelegramBot.Resources;
- using Xunit;
- namespace MafiaTelegramBotTests.Game.Tests.GameRooms.Tests
- {
- public class GameRoomTests
- {
- [Fact]
- public async Task Killing_Player_In_Summing_Up_Phase()
- {
- // arrange
- var gameRoom = new NormalGameRoom();
- var mafia = new Player {Id = -1, ChatId = -1};
- mafia.CurrentRole = new MafiaRole(gameRoom, mafia);
- var actual = new Player {Id = -2, ChatId = -2};
- actual.CurrentRole = new VillagerRole(gameRoom, actual);
- gameRoom.Players.Add(-1, mafia);
- gameRoom.Players.Add(-2, actual);
- await mafia.CurrentRole.SetNightTarget(-2);
- gameRoom.PlayersRole = new Dictionary<Roles, List<Player>>
- {
- [Roles.Mafia] = new() {mafia},
- [Roles.Villager] = new() {actual}
- };
-
- var expected = new Player {Id = -2, ChatId = -2, IsAlive = false};
- expected.CurrentRole = new VillagerRole(gameRoom, expected);
-
- // actual
- await gameRoom.SummingUpPhase();
- // assert
- Assert.Equal(expected.IsAlive, gameRoom.Players[-2].IsAlive);
- }
- }
- }
|