public async Task VisitLobbyPage() { string page = await ApiTester.GetString("/lobby"); page.Should().Contain("<h1>Game lobby</h1>", "This is what TestPlayerBlack sees in the the lobby."); page.Should().Contain("Join one of the open games"); }
public async Task PostJoinGame(string cookie) { var result = await ApiTester.As(cookie).PostForm("/lobby/join", new GameJoinRequest(GameId !, null)); result.StatusCode.Should().Be(302); result.RedirectLocation().Should().Match($"/game/{GameId}?success=*"); }
public async Task VisitLobbyPageAsGuest() { string page = await ApiTester.GetString("/lobby"); page.Should().Contain("<h1>Game lobby</h1>", "This is what guest sees in the the lobby."); page.Should().Contain("The list of open games."); }
public async Task VisitSpectatorPageAsGuest() { string page = await ApiTester.GetString("/lobby/spectate"); page.Should().Contain("<h1>Spectator lounge</h1>", "This is what guest sees in the the spectator lounge."); page.Should().Contain("Watch one of the games currently being played."); }
public async Task <string> ViewGamePage() { string page = await ApiTester.GetString($"/game/{GameId}"); page.Should().Contain($"<h1>Game {GameId}</h1>"); return(page); }
public async Task PostDeleteRole() { var result = await ApiTester.Post($"/modpanel/role/{RoleId}/delete"); result.StatusCode.Should().Be(302); result.RedirectLocation().Should().Match("/modpanel/roles?success=*"); }
public async Task PostRemoveUserFromRole() { long userId = UserDatabase.TestPlayerBlack; var result = await ApiTester.Post($"/modpanel/role/{RoleId}/user/{userId}/remove"); result.StatusCode.Should().Be(302); result.RedirectLocation().Should().Match($"/modpanel/role/{RoleId}/users?success=*"); }
public async Task PostAssignUserToRole() { var result = await ApiTester.PostForm($"/modpanel/role/{RoleId}/user", new AssignUserToRoleRequest("TestPlayerBlack")); result.StatusCode.Should().Be(302); result.RedirectLocation().Should().Match($"/modpanel/role/{RoleId}/users?success=*"); }
public async Task PostEditRole() { var result = await ApiTester.PostForm($"/modpanel/role/{RoleId}/edit", new EditRoleRequest("IT test role", new string[] { Permission.Permissions.PLAY_GAME })); result.StatusCode.Should().Be(302); result.RedirectLocation().Should().Match("/modpanel/roles?success=*"); }
public async Task PostCreateRole() { var result = await ApiTester.PostForm("/modpanel/role/create", new CreateRoleRequest("New IT test role")); result.StatusCode.Should().Be(302); if (!ApiTester.TryRegex(result.RedirectLocation(), @"/modpanel/role/(\d+)/edit", out string?value)) { result.RedirectLocation().Should().Match("/modpanel/role/<some-value>/edit?success=*"); return; } RoleId = new RoleId(long.Parse(value)); result.RedirectLocation().Should().Match($"/modpanel/role/{RoleId}/edit?success=*"); }
public async Task PostCreateGame(string cookie) { var result = await ApiTester.As(cookie).PostForm("/lobby/create", new GameCreationRequest(6, true, true, true, "max", "black")); result.StatusCode.Should().Be(302); if (!ApiTester.TryRegex(result.RedirectLocation(), @"/game/(\d+)", out string?value)) { result.RedirectLocation().Should().Match("/game/<some-value>?success=*"); return; } GameId = new GameId(long.Parse(value)); result.RedirectLocation().Should().Match($"/game/{GameId}?success=*"); }
public async Task VisitCreateGamePage() { string page = await ApiTester.GetString("/lobby/create"); page.Should().Contain("<h1>Create a game</h1>", "This is what TestPlayerBlack sees in the the create a game page."); }
public async Task ViewManageRolesPage() { string page = await ApiTester.GetString("/modpanel/roles"); page.Should().Contain("<h1>Mod panel - Manage roles</h1>"); }
public async Task ViewRoleUsersPage() { string page = await ApiTester.GetString($"/modpanel/role/{RoleId}/users"); page.Should().Contain("<h1>Mod panel - Role users</h1>"); }
public async Task ViewEditRolePage() { string page = await ApiTester.GetString($"/modpanel/role/{RoleId}/edit"); page.Should().Contain("<h1>Mod panel - Edit role</h1>"); }
public async Task PostMove(int from, int to, string cookie) { var result = await ApiTester.As(cookie).PostJson($"/game/{GameId}/move", new MoveRequest(from, to)); result.StatusCode.Should().Be(200); }
public async Task ViewModPanelOverviewPage() { string page = await ApiTester.GetString("/modpanel"); page.Should().Contain("<h1>Mod panel - Overview</h1>"); }