public async Task Handler_Searches_Giant_Bomb_When_Request_Is_Video_Game() { var request = new SearchForGameRequest(GameCategoryReference.VideoGame, "Dark Souls"); await _handler.Handle(request, CancellationToken.None); _giantBombProvider.Verify(x => x.SearchForGame(It.IsAny <string>()), Times.Once); }
public async Task Handler_Searches_Board_Game_Geek_When_Request_Is_Video_Game() { var request = new SearchForGameRequest(GameCategoryReference.BoardGame, "Bang!"); await _handler.Handle(request, CancellationToken.None); _boardGameGeekProvider.Verify(x => x.SearchForGame(It.IsAny <string>()), Times.Once); }
public async Task Handler_For_Video_Game_Throws_If_Provider_Returns_Failure() { _giantBombProvider .Setup(x => x.SearchForGame(It.IsAny <string>())) .ReturnsAsync(Result.Failure <IEnumerable <GameSearchResponse> >("Error")); var request = new SearchForGameRequest(GameCategoryReference.VideoGame, "Dark Souls"); Func <Task> callForSearchFailure = async() => await _handler.Handle(request, CancellationToken.None); await callForSearchFailure.Should().ThrowAsync <BadHttpRequestException>(); }
public SearchForGameRequestHandlerTests() { var fixture = new Fixture(); _boardGameGeekProvider = new Mock <IBoardGameGeekProvider>(); _giantBombProvider = new Mock <IGiantBombProvider>(); _testRequest = new SearchForGameRequest(GameCategoryReference.VideoGame, "Dark Souls"); _giantBombProvider .Setup(x => x.SearchForGame(It.IsAny <string>())) .ReturnsAsync(Result.Success(fixture.CreateMany <GameSearchResponse>())); _handler = new SearchForGameRequestHandler(_boardGameGeekProvider.Object, _giantBombProvider.Object); }