コード例 #1
0
        public async Task <IMovieData> GetMovieByTitle(string title)
        {
            var searchResult = await _client.SearchForMovie(title);

            if (searchResult.Results.Count > 0 && searchResult.Results.First() != null)
            {
                var dto = await _client.GetMovie(searchResult.Results.First().Id);

                // Consider if search doesn't match- it will pull bad data
                return(ConvertApiToMovieData(dto));
            }

            return(new MovieData());
        }
コード例 #2
0
        public void Test_GetMovieDetail()
        {
            // Arrange
            var api   = new MovieDBApi(_testKey);
            var title = 20526;

            // Act
            var detail = api.GetMovie(title).GetAwaiter().GetResult();

            // Assert
            Assert.IsNotNull(detail, "Expected non null result");
            Assert.IsTrue(detail.Genres.Length > 0, "Expected non 0 Genre collection");
        }