示例#1
0
        public async Task PostJoinGame()
        {
            var result = await ApiTester.PostForm("/lobby/join", new GameJoinRequest(GameId !, null));

            result.StatusCode.Should().Be(302);
            result.RedirectLocation().Should().Match($"/game/{GameId}?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 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 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=*");
        }
示例#5
0
        public async Task PostCreateGame()
        {
            var result = await ApiTester.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=*");
        }