public void GetSimilarMovieById_When_TheMovieDbDispatcherThrowsException_Throws_Exception() { _entertainmentDispatcherMock.Setup(x => x.GetSimilarMoviesById(It.IsAny <int>())).Throws <Exception>(); var MovieService = new CodeSample.Services.MovieService(_entertainmentDispatcherMock.Object); Assert.Catch <Exception>(() => MovieService.GetSimilarMoviesById(0)); }
public void GetSimilarMovieById_When_Successful_Returns_MovieSearchResponseDTO() { var expectedResult = Builder <MovieSearchResponseDto> .CreateNew().Build(); _entertainmentDispatcherMock.Setup(x => x.GetSimilarMoviesById(It.IsAny <int>())).Returns(expectedResult); var movieService = new CodeSample.Services.MovieService(_entertainmentDispatcherMock.Object); var actualResult = movieService.GetSimilarMoviesById(0); actualResult.ToExpectedObject().ShouldEqual(expectedResult); }
public void GetSimilarMovieById_When_TheMovieDbDispatcherThrowsStrategyCorpsException_Throws_Exception() { var expectedException = Builder <StrategyCorpsException> .CreateNew() .With(x => x.StrategyCorpsErrorCode = ErrorCode.Default).Build(); _entertainmentDispatcherMock.Setup(x => x.GetSimilarMoviesById(It.IsAny <int>())).Throws(expectedException); var movieService = new CodeSample.Services.MovieService(_entertainmentDispatcherMock.Object); var actualException = Assert.Catch <Exception>(() => movieService.GetSimilarMoviesById(0)); actualException.ToExpectedObject().ShouldEqual(expectedException); }