Beispiel #1
0
        public void GetMovieAlternativeTitlesById_When_TheMovieDbDispatcherThrowsException_Throws_Exception()
        {
            _entertainmentDispatcherMock.Setup(x => x.GetMovieAlternativeTitlesById(It.IsAny <int>())).Throws <Exception>();
            var movieService = new CodeSample.Services.MovieService(_entertainmentDispatcherMock.Object);

            Assert.Catch <Exception>(() => movieService.GetAlternativeMovieTitlesById(0));
        }
Beispiel #2
0
        public void GetMoviesByQuery_When_TheMovieDbDispatcherThrowsException_Throws_Exception()
        {
            _entertainmentDispatcherMock.Setup(x => x.GetMoviesByQuery(It.IsAny <string>())).Throws <Exception>();
            var movieService = new CodeSample.Services.MovieService(_entertainmentDispatcherMock.Object);

            Assert.Catch <Exception>(() => movieService.GetMoviesByQuery(null));
        }
Beispiel #3
0
        public void GetMovieAlternativeTitlesById_When_Successful_Returns_MovieAlternativeTitlesResponseDTO()
        {
            var expectedResult = Builder <MovieAlternativeTitlesResponseDto> .CreateNew().Build();

            _entertainmentDispatcherMock.Setup(x => x.GetMovieAlternativeTitlesById(It.IsAny <int>())).Returns(expectedResult);
            var movieService = new CodeSample.Services.MovieService(_entertainmentDispatcherMock.Object);
            var actualResult = movieService.GetAlternativeMovieTitlesById(0);

            actualResult.ToExpectedObject().ShouldEqual(expectedResult);
        }
Beispiel #4
0
        public void GetMoviesByQuery_When_Successful_Returns_MovieSearchResponseDTO()
        {
            var expectedResult = Builder <MovieSearchResponseDto> .CreateNew().Build();

            _entertainmentDispatcherMock.Setup(x => x.GetMoviesByQuery(It.IsAny <string>())).Returns(expectedResult);
            var movieService = new CodeSample.Services.MovieService(_entertainmentDispatcherMock.Object);
            var actualResult = movieService.GetMoviesByQuery(null);

            actualResult.ToExpectedObject().ShouldEqual(expectedResult);
        }
Beispiel #5
0
        public void GetMovieAlternativeTitlesById_When_TheMovieDbDispatcherThrowsStrategyCorpsException_Throws_Exception()
        {
            var expectedException = Builder <StrategyCorpsException> .CreateNew()
                                    .With(x => x.StrategyCorpsErrorCode = ErrorCode.Default).Build();

            _entertainmentDispatcherMock.Setup(x => x.GetMovieAlternativeTitlesById(It.IsAny <int>())).Throws(expectedException);
            var movieService = new CodeSample.Services.MovieService(_entertainmentDispatcherMock.Object);

            var actualException = Assert.Catch <Exception>(() => movieService.GetAlternativeMovieTitlesById(0));

            actualException.ToExpectedObject().ShouldEqual(expectedException);
        }