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=*");
        }
예제 #2
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=*");
        }