Ejemplo n.º 1
0
        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");
        }
Ejemplo n.º 2
0
        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=*");
        }
Ejemplo n.º 3
0
        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.");
        }
Ejemplo n.º 4
0
        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.");
        }
Ejemplo n.º 5
0
        public async Task <string> ViewGamePage()
        {
            string page = await ApiTester.GetString($"/game/{GameId}");

            page.Should().Contain($"<h1>Game {GameId}</h1>");
            return(page);
        }
Ejemplo n.º 6
0
        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=*");
        }
Ejemplo n.º 7
0
        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=*");
        }
Ejemplo n.º 8
0
        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=*");
        }
Ejemplo n.º 9
0
        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=*");
        }
Ejemplo n.º 10
0
        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=*");
        }
Ejemplo n.º 11
0
        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=*");
        }
Ejemplo n.º 12
0
        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.");
        }
Ejemplo n.º 13
0
        public async Task ViewManageRolesPage()
        {
            string page = await ApiTester.GetString("/modpanel/roles");

            page.Should().Contain("<h1>Mod panel - Manage roles</h1>");
        }
Ejemplo n.º 14
0
        public async Task ViewRoleUsersPage()
        {
            string page = await ApiTester.GetString($"/modpanel/role/{RoleId}/users");

            page.Should().Contain("<h1>Mod panel - Role users</h1>");
        }
Ejemplo n.º 15
0
        public async Task ViewEditRolePage()
        {
            string page = await ApiTester.GetString($"/modpanel/role/{RoleId}/edit");

            page.Should().Contain("<h1>Mod panel - Edit role</h1>");
        }
Ejemplo n.º 16
0
        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);
        }
Ejemplo n.º 17
0
        public async Task ViewModPanelOverviewPage()
        {
            string page = await ApiTester.GetString("/modpanel");

            page.Should().Contain("<h1>Mod panel - Overview</h1>");
        }