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 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 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); }