当前位置: 首页>>代码示例>>C#>>正文


C# Uri.IsImdbMovieUrl方法代码示例

本文整理汇总了C#中System.Uri.IsImdbMovieUrl方法的典型用法代码示例。如果您正苦于以下问题:C# Uri.IsImdbMovieUrl方法的具体用法?C# Uri.IsImdbMovieUrl怎么用?C# Uri.IsImdbMovieUrl使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Uri的用法示例。


在下文中一共展示了Uri.IsImdbMovieUrl方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Search

        /// <summary>
        /// Search for a movie's posters based on an IMDb movie URL.
        /// </summary>
        /// <param name="imdbMovieUrl">The IMDb movie URL.</param>
        /// <param name="imageWidth">The poster image's width to return.</param>
        /// <returns>The API result containing the movie's information and posters.</returns>
        /// <exception cref="ArgumentNullException">Thrown when <paramref name="imdbMovieUrl"/> is <c>null</c>.</exception>
        /// <exception cref="ArgumentException">Thrown when <paramref name="imdbMovieUrl"/> is not a valid IMDb movie url.</exception>
        /// <exception cref="ArgumentOutOfRangeException">Thrown when <paramref name="imageWidth"/> is not within the [30-300] range.</exception>
        public MoviePosterDbResult Search(Uri imdbMovieUrl, int imageWidth)
        {
            Check.NotNull(imdbMovieUrl, "imdbMovieUrl");
            Check.That(imdbMovieUrl.IsImdbMovieUrl(), "imdbMovieUrl", InvalidImdbMovieUrlMessage);
            Check.InRange(imageWidth, MinimumImageWidth, MaximumImageWidth, "imageWidth");

            return RequestAndParseApiUrl(this.GetApiUrl(imdbMovieUrl, imageWidth));
        }
开发者ID:gmershad,项目名称:MoviePosterDb,代码行数:17,代码来源:MoviePosterDbService.cs

示例2: IsImdbMovieUrlUsingIncompleteImdbMovieUrlReturnsFalse

        public void IsImdbMovieUrlUsingIncompleteImdbMovieUrlReturnsFalse(string incompleteImdbMovieUrl)
        {
            // Arrange
            var url = new Uri(incompleteImdbMovieUrl);

            // Act
            var isImdbMovieUrl = url.IsImdbMovieUrl();

            // Assert
            Assert.False(isImdbMovieUrl);
        }
开发者ID:gmershad,项目名称:MoviePosterDb,代码行数:11,代码来源:UriExtensionsTests.cs

示例3: IsImdbMovieUrlUsingValidImdbMovieUrlReturnsTrue

        public void IsImdbMovieUrlUsingValidImdbMovieUrlReturnsTrue(string validImdbMovieUrl)
        {
            // Arrange
            var url = new Uri(validImdbMovieUrl);

            // Act
            var isImdbMovieUrl = url.IsImdbMovieUrl();

            // Assert
            Assert.True(isImdbMovieUrl);
        }
开发者ID:gmershad,项目名称:MoviePosterDb,代码行数:11,代码来源:UriExtensionsTests.cs

示例4: CalculateSecret

        /// <summary>
        /// Calculate the API call secret based on an IMDb movie URL.
        /// </summary>
        /// <param name="imdbMovieUrl">The IMDb movie URL.</param>
        /// <returns>The API secret to be used in the API call.</returns>
        /// <exception cref="ArgumentNullException">Thrown when <paramref name="imdbMovieUrl"/> is <c>null</c>.</exception>
        /// <exception cref="ArgumentException">Thrown when <paramref name="imdbMovieUrl"/> is not a valid IMDb movie url.</exception>
        public string CalculateSecret(Uri imdbMovieUrl)
        {
            Check.NotNull(imdbMovieUrl, "imdbMovieUrl");
            Check.That(imdbMovieUrl.IsImdbMovieUrl(), "imdbMovieUrl", InvalidImdbMovieUrlMessage);

            return this.CalculateSecret(imdbMovieUrl.GetImdbMovieId());
        }
开发者ID:gmershad,项目名称:MoviePosterDb,代码行数:14,代码来源:MoviePosterDbService.cs

示例5: GetApiUrl

        /// <summary>
        /// Get the API url for an IMDb movie URL search.
        /// </summary>
        /// <param name="imdbMovieUrl">The IMDb movie URL.</param>
        /// <param name="imageWidth">The poster image's width to return.</param>
        /// <returns>The API URL to search for the posters for specified IMDb movie ID.</returns>
        /// <exception cref="ArgumentNullException">Thrown when <paramref name="imdbMovieUrl"/> is <c>null</c>.</exception>
        /// <exception cref="ArgumentException">Thrown when <paramref name="imdbMovieUrl"/> is not a valid IMDb movie url.</exception>
        /// <exception cref="ArgumentOutOfRangeException">Thrown when <paramref name="imageWidth"/> is not within the [30-300] range.</exception>
        public Uri GetApiUrl(Uri imdbMovieUrl, int imageWidth)
        {
            Check.NotNull(imdbMovieUrl, "imdbMovieUrl");
            Check.That(imdbMovieUrl.IsImdbMovieUrl(), "imdbMovieUrl", InvalidImdbMovieUrlMessage);
            Check.InRange(imageWidth, MinimumImageWidth, MaximumImageWidth, "imageWidth");

            return this.GetApiUrl(imdbMovieUrl.GetImdbMovieId(), imageWidth);
        }
开发者ID:gmershad,项目名称:MoviePosterDb,代码行数:17,代码来源:MoviePosterDbService.cs


注:本文中的System.Uri.IsImdbMovieUrl方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。