本文整理汇总了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));
}
示例2: IsImdbMovieUrlUsingIncompleteImdbMovieUrlReturnsFalse
public void IsImdbMovieUrlUsingIncompleteImdbMovieUrlReturnsFalse(string incompleteImdbMovieUrl)
{
// Arrange
var url = new Uri(incompleteImdbMovieUrl);
// Act
var isImdbMovieUrl = url.IsImdbMovieUrl();
// Assert
Assert.False(isImdbMovieUrl);
}
示例3: IsImdbMovieUrlUsingValidImdbMovieUrlReturnsTrue
public void IsImdbMovieUrlUsingValidImdbMovieUrlReturnsTrue(string validImdbMovieUrl)
{
// Arrange
var url = new Uri(validImdbMovieUrl);
// Act
var isImdbMovieUrl = url.IsImdbMovieUrl();
// Assert
Assert.True(isImdbMovieUrl);
}
示例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());
}
示例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);
}