예제 #1
0
        public async Task Handler_Searches_Giant_Bomb_When_Request_Is_Video_Game()
        {
            var request = new GetSearchedGameDetailsRequest(GameCategoryReference.VideoGame, 69);

            await _handler.Handle(request, CancellationToken.None);

            _giantBombProvider.Verify(x => x.GetGameDetails(It.IsAny <int>()), Times.Once);
        }
예제 #2
0
        public async Task Handler_Searches_Board_Game_Geek_When_Request_Is_Board_Game()
        {
            var request = new GetSearchedGameDetailsRequest(GameCategoryReference.BoardGame, 69);

            await _handler.Handle(request, CancellationToken.None);

            _boardGameGeekProvider.Verify(x => x.GetGameDetails(It.IsAny <int>()), Times.Once);
        }
예제 #3
0
        public async Task Handler_For_Video_Game_Throws_If_Provider_Returns_Failure()
        {
            _giantBombProvider
            .Setup(x => x.GetGameDetails(It.IsAny <int>()))
            .ReturnsAsync(Result.Failure <GameDetailsResponse>("Error"));

            var request = new GetSearchedGameDetailsRequest(GameCategoryReference.VideoGame, 420);

            Func <Task> callForVideoGameDetailsFailure = async() => await _handler.Handle(request, CancellationToken.None);

            await callForVideoGameDetailsFailure.Should().ThrowAsync <BadHttpRequestException>();
        }
예제 #4
0
        public GetSearchedGameDetailsRequestHandlerTests()
        {
            var fixture = new Fixture();

            _boardGameGeekProvider = new Mock <IBoardGameGeekProvider>();
            _giantBombProvider     = new Mock <IGiantBombProvider>();
            _testRequest           = new GetSearchedGameDetailsRequest(GameCategoryReference.VideoGame, 469);

            _giantBombProvider
            .Setup(x => x.GetGameDetails(It.IsAny <int>()))
            .ReturnsAsync(Result.Success(fixture.Create <GameDetailsResponse>()));

            _handler = new GetSearchedGameDetailsRequestHandler(_boardGameGeekProvider.Object, _giantBombProvider.Object);
        }