public void JoiningWhenUserIdOccupiedThrowsValidationError() { var whitePlayer = PlayerTestHelper.White().WithUserId(9999).Build(); var game = GameTestHelper.PendingInternationalGame(whitePlayer).Build(); var blackPlayer = PlayerTestHelper.Black().WithUserId(9999).Build(); Action joinGame = () => game.JoinGame(blackPlayer, _fakeClock.UtcNow()); joinGame.Should().Throw <ManualValidationException>(); }
public void JoiningAsSecondPlayerStartsGame() { var blackPlayer = PlayerTestHelper.Black().Build(); var game = GameTestHelper.PendingInternationalGame(blackPlayer).Build(); var whitePlayer = PlayerTestHelper.White().Build(); game.JoinGame(whitePlayer, _fakeClock.UtcNow()); game.Players.Should().BeEquivalentTo(whitePlayer, blackPlayer); game.HasStarted.Should().BeTrue(); game.Turn.Should().NotBeNull(); game.Turn !.Player.Color.Should().Be(Color.White); }