public async Task Handle_OnRegularInput_ShouldReturnCorrectlyOrderedAndMappedGames() { // arrange string playerId = "player1"; string currentPlayerId = "player2"; var query = new GetPlayerGamesQuery(playerId, currentPlayerId); var handler = new GetPlayerGamesQueryHandler(Context, Mapper); // act PlayerGamesVM result = await handler.Handle(query, CancellationToken.None); // assert result.ShouldBeOfType <PlayerGamesVM>(); result.Games[0].StartDate.ShouldBe(new DateTime(2020, 2, 20).ToString("g")); }
public async Task Handle_WhenResultIsWinAndCurrentUserIsNotCrossPlayer_ShouldReturnDTOWithResultLoss() { // arrange string playerId = "player1"; string currentPlayerId = "player2"; var query = new GetPlayerGamesQuery(playerId, currentPlayerId); var handler = new GetPlayerGamesQueryHandler(Context, Mapper); // act PlayerGamesVM result = await handler.Handle(query, CancellationToken.None); // assert result.ShouldBeOfType <PlayerGamesVM>(); result.Games[1].Result.ShouldBe(Domain.Enums.GameResult.Loss.ToString()); }
public async Task Handle_OnRegularInput_ShouldReturnCorrectNumberOfGames() { // arrange string playerId = "player1"; string currentPlayerId = "player2"; var query = new GetPlayerGamesQuery(playerId, currentPlayerId); var handler = new GetPlayerGamesQueryHandler(Context, Mapper); // act PlayerGamesVM result = await handler.Handle(query, CancellationToken.None); // assert result.ShouldBeOfType <PlayerGamesVM>(); result.Games.Count.ShouldBe(4); }