public async Task Should_return_response(Guid playerId, bool isHost, bool isChallenger) { var context = DbContextFactory.CreateTripleTriadContext(); var game = CreateGame(); await context.Games.AddAsync(game); await context.SaveChangesAsync(); var command = new GameView.Request() { GameId = GameId, PlayerId = playerId }; var subject = new GameView.RequestHandler(context); var response = await subject.Handle(command, default); using (new AssertionScope()) { response.GameId.Should().Be(GameId); response.IsHost.Should().Be(isHost); response.IsChallenger.Should().Be(isChallenger); response.PlayerId.Should().Be(playerId); } }
public void Should_throw_GameNotFoundException(Guid playerId) { var gameId = 1; var context = DbContextFactory.CreateTripleTriadContext(); var command = new GameView.Request() { GameId = gameId, PlayerId = playerId }; var subject = new GameView.RequestHandler(context); Func <Task> act = async() => await subject.Handle(command, default); act.Should() .Throw <GameNotFoundException>() .Where(e => e.GameId == gameId); }