public void SearchUsingImdbMovieUrlWithInvalidImdbMovieUrlThrowsArgumentException(string invalidImdbMovieUrl)
        {
            // Arrange
            var moviePosterDbService = new MoviePosterDbService(ApiKey, ApiSecret);

            // Act

            // Assert
            Assert.Throws<ArgumentException>(() => moviePosterDbService.Search(new Uri(invalidImdbMovieUrl)));
        }
        public void SearchUsingImdbMovieIdAndImageWidthForMovieWithoutPosterReturnsNullForProperties()
        {
            // Arrange
            var moviePosterDbService = new MoviePosterDbService(ApiKey, ApiSecret);

            // Act
            var moviePosterDbResult = moviePosterDbService.Search(ImdbMovieIdWithoutPoster, ImageWidth);

            // Assert
            Assert.Null(moviePosterDbResult.Title);
            Assert.Null(moviePosterDbResult.Year);
            Assert.Null(moviePosterDbResult.ImdbMovieId);
            Assert.Null(moviePosterDbResult.Page);
            Assert.Null(moviePosterDbResult.Posters);
        }
        public void SearchUsingImdbMovieIdAndImageWidthForMovieWithPosterWillReturnCorrectMoviePosterDbResult()
        {
            // Arrange
            var moviePosterDbService = new MoviePosterDbService(ApiKey, ApiSecret);

            // Act
            var moviePosterDbResult = moviePosterDbService.Search(ImdbMovieIdWithPoster, ImageWidth);

            // Assert
            Assert.Equal("Inception", moviePosterDbResult.Title);
            Assert.Equal("2010", moviePosterDbResult.Year);
            Assert.Equal("1375666", moviePosterDbResult.ImdbMovieId);
            Assert.Equal(@"http://api.movieposterdb.com/cache/normal/66/1375666/1375666_100.jpg", moviePosterDbResult.Posters[0].Url);
            Assert.Equal(1, moviePosterDbResult.Posters.Count());
        }
        public void SearchUsingImdbMovieUrlForMovieWithoutPosterReturnsNullForProperties(string imdbMovieUrl)
        {
            // Arrange
            var moviePosterDbService = new MoviePosterDbService(ApiKey, ApiSecret);

            // Act
            var moviePosterDbResult = moviePosterDbService.Search(new Uri(imdbMovieUrl));

            // Assert
            Assert.Null(moviePosterDbResult.Title);
            Assert.Null(moviePosterDbResult.Year);
            Assert.Null(moviePosterDbResult.ImdbMovieId);
            Assert.Null(moviePosterDbResult.Page);
            Assert.Null(moviePosterDbResult.Posters);
        }
        public void CalculateSecretUsingImdbMovieIdOutOfRangeThrowsArgumentOutOfRangeException(int invalidImdbMovieId)
        {
            // Arrange
            var moviePosterDbService = new MoviePosterDbService(ApiKey, ApiSecret);

            // Act

            // Assert
            Assert.Throws<ArgumentOutOfRangeException>(() => moviePosterDbService.CalculateSecret(invalidImdbMovieId));
        }
        public void CalculateSecretUsingImdbMovieUrlReturnsCorrectSecret(string imdbMovieUrl)
        {
            // Arrange
            var moviePosterDbService = new MoviePosterDbService(ApiKey, ApiSecret);

            // Act
            var calculateSecret = moviePosterDbService.CalculateSecret(new Uri(imdbMovieUrl));

            // Assert
            Assert.Equal("8435ce4c53ff", calculateSecret);
        }
        public void CalculateSecretUsingNullImdbMovieUrlThrowsArgumentNullException()
        {
            // Arrange
            Uri nullImdbMovieUrl = null;
            var moviePosterDbService = new MoviePosterDbService(ApiKey, ApiSecret);

            // Act

            // Assert
            Assert.Throws<ArgumentNullException>(() => moviePosterDbService.CalculateSecret(nullImdbMovieUrl));
        }
        public void GetApiUrlUsingImdbMovieIdOutOfRangeThrowsArgumentOutOfRangeException(int invalidImdbMovieId)
        {
            // Arrange
            var moviePosterDbService = new MoviePosterDbService(ApiKey, ApiSecret);

            // Act

            // Assert
            Assert.Throws<ArgumentOutOfRangeException>(() => moviePosterDbService.GetApiUrl(invalidImdbMovieId, ImageWidth));
        }
        public void GetApiUrlUsingInvalidImdbMovieUrlThrowsArgumentException(string invalidImdbMovieUrl)
        {
            // Arrange
            var moviePosterDbService = new MoviePosterDbService(ApiKey, ApiSecret);

            // Act

            // Assert
            Assert.Throws<ArgumentException>(() => moviePosterDbService.GetApiUrl(new Uri(invalidImdbMovieUrl), ImageWidth));
        }
        public void GetApiUrlUsingNullImdbMovieUrlThrowsArgumentNullException()
        {
            // Arrange
            Uri nullImdbMovieUrl = null;
            var moviePosterDbService = new MoviePosterDbService(ApiKey, ApiSecret);

            // Act

            // Assert
            Assert.Throws<ArgumentNullException>(() => moviePosterDbService.GetApiUrl(nullImdbMovieUrl, ImageWidth));
        }
        public void GetApiUrlUsingImdbMovieUrlReturnsCorrectApiUrl(string imdbMovieUrl)
        {
            // Arrange
            var moviePosterDbService = new MoviePosterDbService(ApiKey, ApiSecret);

            // Act
            var apiUrl = moviePosterDbService.GetApiUrl(new Uri(imdbMovieUrl), ImageWidth);

            // Assert
            Assert.Equal("http://api.movieposterdb.com/json?imdb_code=2304771&api_key=test-api-key&secret=8435ce4c53ff&width=300", apiUrl.ToString());
        }
        public void SearchUsingImdbMovieUrlAndImageWidthOutOfRangeThrowsArgumentOutOfRangeException(int invalidImageWidth)
        {
            // Arrange
            var moviePosterDbService = new MoviePosterDbService(ApiKey, ApiSecret);

            // Act

            // Assert
            Assert.Throws<ArgumentOutOfRangeException>(() => moviePosterDbService.Search(new Uri(ImdbMovieUrl), invalidImageWidth));
        }