/// <summary> /// Initializes a new instance of the <see cref="Podcast"/> class. /// </summary> /// <param name="category">The podcast category.</param> /// <param name="quality">The podcast quality.</param> /// <exception cref="System.ComponentModel.InvalidEnumArgumentException"><em>category</em> /// or <em>quality</em> is invalid enumeration.</exception> public Podcast(PodcastCategory category, PodcastQuality quality) { Precondition.IsValidEnum(category, nameof(category)); Precondition.IsValidEnum(quality, nameof(quality)); Category = category; Quality = quality; }
/// <summary> /// Initializes a new instance of the <see cref="Podcast"/> class. /// </summary> /// <param name="category">The podcast category.</param> /// <param name="quality">The podcast quality.</param> /// <param name="subdomain">The podcast subdomain.</param> /// <param name="title">The podcast title.</param> /// <param name="subtitle">The podcast subtitle.</param> /// <param name="description">The podcast description.</param> /// <param name="introOutroFiles">The podcast intro/outro files.</param> /// <param name="language">The podcast language.</param> /// <param name="authors">The podcast authors.</param> /// <param name="coverImage">The podcast cover image.</param> /// <param name="websiteUrl">The podcast website URL.</param> /// <param name="ownerEmail">The owner email.</param> /// <param name="publicationType">The podcast publication type.</param> /// <param name="explicit">A value that indicates whether the podcast content is explicit.</param> /// <param name="flattrId">The Flatter ID.</param> /// <param name="twitter">The Twitter name.</param> /// <param name="facebook">The Facebook name.</param> /// <param name="copyrightText">The podcast copyright text.</param> /// <param name="feedItems">The number of feed items.</param> /// <param name="transcriptionsEnabled">A value that indicates whether the podcast transcription is enabled.</param> /// <param name="transcriptionLanguage">The podcast transcription language.</param> /// <param name="externalSiteUrl">The podcast external site URL.</param> /// <param name="domain">The podcast domain.</param> /// <exception cref="ArgumentOutOfRangeException"><em>feedItems</em></exception> is less /// then 1 or greater then 999999. /// <exception cref="System.ComponentModel.InvalidEnumArgumentException"><em>category</em> /// or <em>quality</em> is invalid enumeration.</exception> public Podcast( PodcastCategory category, PodcastQuality quality, string subdomain, string title, string subtitle, string description, List <ProductionFile> introOutroFiles, PodcastLanguage?language, string authors, string coverImage, string websiteUrl, string ownerEmail, PodcastPublicationType publicationType, bool @explicit, string flattrId, string twitter, string facebook, string copyrightText, int feedItems, bool transcriptionsEnabled, TranscriptionLanguage?transcriptionLanguage, string externalSiteUrl, string domain) { Precondition.IsValidEnum(category, nameof(category)); Precondition.IsValidEnum(quality, nameof(quality)); Precondition.IsBetween(feedItems, 1, 999999, nameof(feedItems)); Category = category; Quality = quality; Subdomain = subdomain; Title = title; Subtitle = subtitle; Description = description; IntroOutroFiles = introOutroFiles; Language = language; Authors = authors; CoverImage = coverImage; WebsiteUrl = websiteUrl; OwnerEmail = ownerEmail; PublicationType = publicationType; Explicit = @explicit; FlattrId = flattrId; Twitter = twitter; Facebook = facebook; CopyrightText = copyrightText; FeedItems = feedItems; TranscriptionsEnabled = transcriptionsEnabled; TranscriptionLanguage = transcriptionLanguage; ExternalSiteUrl = externalSiteUrl; Domain = domain; }
public void Initialize_Constructor_3( [Values(PodcastCategory.Podcasting, (PodcastCategory)100)] PodcastCategory category, [Values(PodcastQuality.SuperHigh, (PodcastQuality)100)] PodcastQuality quality, [Values("subdomain")] string subdomain, [Values("title")] string title, [Values("subtitle")] string subtitle, [Values("description")] string description, [Values(null)] List <ProductionFile> introOutroFiles, [Values(null)] PodcastLanguage?language, [Values("authors")] string authors, [Values("coverImage")] string coverImage, [Values("websiteUrl")] string websiteUrl, [Values("ownerEmail")] string ownerEmail, [Values(PodcastPublicationType.Serial)] PodcastPublicationType publicationType, [Values(false)] bool @explicit, [Values("flattrId")] string flattrId, [Values("twitter")] string twitter, [Values("facebook")] string facebook, [Values("copyrightText")] string copyrightText, [Values(0, 10, 1000000)] int feedItems, [Values(false)] bool transcriptionsEnabled, [Values(null)] TranscriptionLanguage?transcriptionLanguage, [Values("externalSiteUrl")] string externalSiteUrl, [Values("domain")] string domain) { Type expectedException = null; string expectedParamName = null; if (category == (PodcastCategory)100) { expectedException = typeof(InvalidEnumArgumentException); expectedParamName = nameof(category); } else if (quality == (PodcastQuality)100) { expectedException = typeof(InvalidEnumArgumentException); expectedParamName = nameof(quality); } else if (feedItems == 0 || feedItems == 1000000) { expectedException = typeof(ArgumentOutOfRangeException); expectedParamName = nameof(feedItems); } if (expectedException == null) { Podcast podcast = null; Assert.That(() => podcast = new Podcast( category, quality, subdomain, title, subtitle, description, introOutroFiles, language, authors, coverImage, websiteUrl, ownerEmail, publicationType, @explicit, flattrId, twitter, facebook, copyrightText, feedItems, transcriptionsEnabled, transcriptionLanguage, externalSiteUrl, domain), Throws.Nothing); Assert.Multiple(() => { Assert.That(podcast.Id, Is.EqualTo(0), "Id"); Assert.That(podcast.Subdomain, Is.EqualTo(subdomain), "Subdomain"); Assert.That(podcast.Category, Is.EqualTo(category), "Category"); Assert.That(podcast.Title, Is.EqualTo(title), "Title"); Assert.That(podcast.Subtitle, Is.EqualTo(subtitle), "Subtitle"); Assert.That(podcast.Description, Is.EqualTo(description), "Description"); Assert.That(podcast.IntroOutroFiles, Is.EqualTo(introOutroFiles), "IntroOutroFiles"); Assert.That(podcast.Quality, Is.EqualTo(quality), "Quality"); Assert.That(podcast.Language, Is.EqualTo(language), "Language"); Assert.That(podcast.Authors, Is.EqualTo(authors), "Authors"); Assert.That(podcast.CoverImage, Is.EqualTo(coverImage), "CoverImage"); Assert.That(podcast.WebsiteUrl, Is.EqualTo(websiteUrl), "WebsiteUrl"); Assert.That(podcast.OwnerEmail, Is.EqualTo(ownerEmail), "OwnerEmail"); Assert.That(podcast.PublishedAt, Is.EqualTo(DateTime.MinValue), "PublishedAt"); Assert.That(podcast.CreatedAt, Is.EqualTo(DateTime.MinValue), "CreatedAt"); Assert.That(podcast.UpdatedAt, Is.EqualTo(DateTime.MinValue), "UpdatedAt"); Assert.That(podcast.Keywords, Is.Null, "Keywords"); Assert.That(podcast.Feeds, Is.Null, "Feeds"); Assert.That(podcast.PublicationType, Is.EqualTo(publicationType), "PublicationType"); Assert.That(podcast.Explicit, Is.EqualTo(@explicit), "Explicit"); Assert.That(podcast.FlattrId, Is.EqualTo(flattrId), "FlattrId"); Assert.That(podcast.Twitter, Is.EqualTo(twitter), "Twitter"); Assert.That(podcast.Facebook, Is.EqualTo(facebook), "Facebook"); Assert.That(podcast.ItunesId, Is.Null, "ItunesId"); Assert.That(podcast.SpotifyUrl, Is.Null, "SpotifyUrl"); Assert.That(podcast.DeezerUrl, Is.Null, "DeezerUrl"); Assert.That(podcast.AlexaUrl, Is.Null, "AlexaUrl"); Assert.That(podcast.CopyrightText, Is.EqualTo(copyrightText), "CopyrightText"); Assert.That(podcast.FeedItems, Is.EqualTo(feedItems), "FeedItems"); Assert.That(podcast.TranscriptionsEnabled, Is.EqualTo(transcriptionsEnabled), "TranscriptionsEnabled"); Assert.That(podcast.TranscriptionLanguage, Is.EqualTo(transcriptionLanguage), "TranscriptionLanguage"); Assert.That(podcast.ExternalSiteUrl, Is.EqualTo(externalSiteUrl), "ExternalSiteUrl"); Assert.That(podcast.Domain, Is.EqualTo(domain), "Domain"); }); } else { Assert.That(() => new Podcast( category, quality, subdomain, title, subtitle, description, introOutroFiles, language, authors, coverImage, websiteUrl, ownerEmail, publicationType, @explicit, flattrId, twitter, facebook, copyrightText, feedItems, transcriptionsEnabled, transcriptionLanguage, externalSiteUrl, domain), Throws .Exception.TypeOf(expectedException) .With.Property("ParamName").EqualTo(expectedParamName)); } }
public void Initialize_Constructor_2( [Values(PodcastCategory.Podcasting, (PodcastCategory)100)] PodcastCategory category, [Values(PodcastQuality.SuperHigh, (PodcastQuality)100)] PodcastQuality quality) { Type expectedException = null; string expectedParamName = null; if (category == (PodcastCategory)100) { expectedException = typeof(InvalidEnumArgumentException); expectedParamName = nameof(category); } else if (quality == (PodcastQuality)100) { expectedException = typeof(InvalidEnumArgumentException); expectedParamName = nameof(quality); } if (expectedException == null) { Podcast podcast = null; Assert.That(() => podcast = new Podcast(category, quality), Throws.Nothing); Assert.Multiple(() => { Assert.That(podcast.Id, Is.EqualTo(0), "Id"); Assert.That(podcast.Subdomain, Is.Null, "Subdomain"); Assert.That(podcast.Category, Is.EqualTo(category), "Category"); Assert.That(podcast.Title, Is.Null, "Title"); Assert.That(podcast.Subtitle, Is.Null, "Subtitle"); Assert.That(podcast.Description, Is.Null, "Description"); Assert.That(podcast.IntroOutroFiles, Is.Null, "IntroOutroFiles"); Assert.That(podcast.Quality, Is.EqualTo(quality), "Quality"); Assert.That(podcast.Language, Is.Null, "Language"); Assert.That(podcast.Authors, Is.Null, "Authors"); Assert.That(podcast.CoverImage, Is.Null, "CoverImage"); Assert.That(podcast.WebsiteUrl, Is.Null, "WebsiteUrl"); Assert.That(podcast.OwnerEmail, Is.Null, "OwnerEmail"); Assert.That(podcast.PublishedAt, Is.EqualTo(DateTime.MinValue), "PublishedAt"); Assert.That(podcast.CreatedAt, Is.EqualTo(DateTime.MinValue), "CreatedAt"); Assert.That(podcast.UpdatedAt, Is.EqualTo(DateTime.MinValue), "UpdatedAt"); Assert.That(podcast.Keywords, Is.Null, "Keywords"); Assert.That(podcast.Feeds, Is.Null, "Feeds"); Assert.That(podcast.PublicationType, Is.EqualTo(PodcastPublicationType.Episodic), "PublicationType"); Assert.That(podcast.Explicit, Is.False, "Explicit"); Assert.That(podcast.FlattrId, Is.Null, "FlattrId"); Assert.That(podcast.Twitter, Is.Null, "Twitter"); Assert.That(podcast.Facebook, Is.Null, "Facebook"); Assert.That(podcast.ItunesId, Is.Null, "ItunesId"); Assert.That(podcast.SpotifyUrl, Is.Null, "SpotifyUrl"); Assert.That(podcast.DeezerUrl, Is.Null, "DeezerUrl"); Assert.That(podcast.AlexaUrl, Is.Null, "AlexaUrl"); Assert.That(podcast.CopyrightText, Is.Null, "CopyrightText"); Assert.That(podcast.FeedItems, Is.EqualTo(0), "FeedItems"); Assert.That(podcast.TranscriptionsEnabled, Is.False, "TranscriptionsEnabled"); Assert.That(podcast.TranscriptionLanguage, Is.Null, "TranscriptionLanguage"); Assert.That(podcast.ExternalSiteUrl, Is.Null, "ExternalSiteUrl"); Assert.That(podcast.Domain, Is.Null, "Domain"); }); } else { Assert.That(() => new Podcast(category, quality), Throws .Exception.TypeOf(expectedException) .With.Property("ParamName").EqualTo(expectedParamName)); } }