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 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 #3
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);
        }