本文整理匯總了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);
}