public async Task Get_Game_Details_Returns_Failure_If_Api_Client_Returns_Failure() { _apiClient .Setup(x => x.SendGameDetailsRequest(It.IsAny <IEnumerable <int> >())) .ReturnsAsync(Result.Failure <BoardGameGeekDetailsResult>("Error")); var result = await _provider.GetGameDetails(1); result.IsFailure.Should().BeTrue(); }
public async Task <GameDetailsResponse> Handle(GetSearchedGameDetailsRequest request, CancellationToken cancellationToken) { if (request.Category == GameCategoryReference.BoardGame) { var boardGameDetails = await _boardGameGeekProvider.GetGameDetails(request.GameId); return(boardGameDetails.IsSuccess ? boardGameDetails.Value : throw new BadHttpRequestException(boardGameDetails.Error)); } var videoGameDetails = await _giantBombProvider.GetGameDetails(request.GameId); return(videoGameDetails.IsSuccess ? videoGameDetails.Value : throw new BadHttpRequestException(videoGameDetails.Error)); }