-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
1 parent
464f601
commit 01b571d
Showing
17 changed files
with
1,026 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
80 changes: 80 additions & 0 deletions
80
...tBuilder.Tests/CommentPostBuilder/TraktPost_EpisodeCommentPostBuilder_Exceptions_Tests.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
namespace TraktNet.PostBuilder.Tests | ||
{ | ||
using FluentAssertions; | ||
using System; | ||
using Trakt.NET.Tests.Utility.Traits; | ||
using TraktNet.Objects.Get.Episodes; | ||
using TraktNet.Objects.Post.Comments; | ||
using Xunit; | ||
|
||
[Category("PostBuilder")] | ||
public partial class TraktPost_EpisodeCommentPostBuilder_Tests | ||
{ | ||
[Fact] | ||
public void Test_TraktPost_EpisodeCommentPostBuilder_WithComment_ArgumentNullException() | ||
{ | ||
Func<ITraktEpisodeCommentPost> act = () => TraktPost.NewEpisodeCommentPost() | ||
.WithComment(null) | ||
.WithEpisode(TraktPost_Tests_Common_Data.EPISODE_1) | ||
.Build(); | ||
|
||
act.Should().Throw<ArgumentNullException>(); | ||
} | ||
|
||
[Fact] | ||
public void Test_TraktPost_EpisodeCommentPostBuilder_WithComment_ArgumentOutOfRangeException() | ||
{ | ||
Func<ITraktEpisodeCommentPost> act = () => TraktPost.NewEpisodeCommentPost() | ||
.WithComment(TraktPost_Tests_Common_Data.INVALID_COMMENT) | ||
.WithEpisode(TraktPost_Tests_Common_Data.EPISODE_1) | ||
.Build(); | ||
|
||
act.Should().Throw<ArgumentOutOfRangeException>(); | ||
} | ||
|
||
[Fact] | ||
public void Test_TraktPost_EpisodeCommentPostBuilder_WithEpisode_Episode_ArgumentNullException() | ||
{ | ||
Func<ITraktEpisodeCommentPost> act = () => TraktPost.NewEpisodeCommentPost() | ||
.WithComment(TraktPost_Tests_Common_Data.VALID_COMMENT) | ||
.WithEpisode(null) | ||
.Build(); | ||
|
||
act.Should().Throw<ArgumentNullException>(); | ||
} | ||
|
||
[Fact] | ||
public void Test_TraktPost_EpisodeCommentPostBuilder_WithEpisode_EpisodeIds_ArgumentNullException() | ||
{ | ||
Func<ITraktEpisodeCommentPost> act = () => TraktPost.NewEpisodeCommentPost() | ||
.WithComment(TraktPost_Tests_Common_Data.VALID_COMMENT) | ||
.WithEpisode(new TraktEpisode()) | ||
.Build(); | ||
|
||
act.Should().Throw<ArgumentNullException>(); | ||
} | ||
|
||
[Fact] | ||
public void Test_TraktPost_EpisodeCommentPostBuilder_WithEpisode_EpisodeIds_ArgumentException() | ||
{ | ||
Func<ITraktEpisodeCommentPost> act = () => TraktPost.NewEpisodeCommentPost() | ||
.WithComment(TraktPost_Tests_Common_Data.VALID_COMMENT) | ||
.WithEpisode(new TraktEpisode { Ids = new TraktEpisodeIds() }) | ||
.Build(); | ||
|
||
act.Should().Throw<ArgumentException>(); | ||
} | ||
|
||
[Fact] | ||
public void Test_TraktPost_EpisodeCommentPostBuilder_WithSharing_ArgumentNullException() | ||
{ | ||
Func<ITraktEpisodeCommentPost> act = () => TraktPost.NewEpisodeCommentPost() | ||
.WithComment(TraktPost_Tests_Common_Data.VALID_COMMENT) | ||
.WithEpisode(TraktPost_Tests_Common_Data.EPISODE_1) | ||
.WithSharing(null) | ||
.Build(); | ||
|
||
act.Should().Throw<ArgumentNullException>(); | ||
} | ||
} | ||
} |
121 changes: 121 additions & 0 deletions
121
...akt.NET.PostBuilder.Tests/CommentPostBuilder/TraktPost_EpisodeCommentPostBuilder_Tests.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,121 @@ | ||
namespace TraktNet.PostBuilder.Tests | ||
{ | ||
using FluentAssertions; | ||
using System; | ||
using Trakt.NET.Tests.Utility.Traits; | ||
using TraktNet.Objects.Post.Comments; | ||
using Xunit; | ||
|
||
[Category("PostBuilder")] | ||
public partial class TraktPost_EpisodeCommentPostBuilder_Tests | ||
{ | ||
[Fact] | ||
public void Test_TraktPost_EpisodeCommentPostBuilder_Empty_Build() | ||
{ | ||
Func<ITraktEpisodeCommentPost> act = () => TraktPost.NewEpisodeCommentPost().Build(); | ||
act.Should().Throw<ArgumentNullException>(); | ||
} | ||
|
||
[Fact] | ||
public void Test_TraktPost_EpisodeCommentPostBuilder_Comment_Episode() | ||
{ | ||
ITraktEpisodeCommentPost episodeCommentPost = TraktPost.NewEpisodeCommentPost() | ||
.WithComment(TraktPost_Tests_Common_Data.VALID_COMMENT) | ||
.WithEpisode(TraktPost_Tests_Common_Data.EPISODE_1) | ||
.Build(); | ||
|
||
episodeCommentPost.Should().NotBeNull(); | ||
episodeCommentPost.Comment.Should().Be(TraktPost_Tests_Common_Data.VALID_COMMENT); | ||
episodeCommentPost.Episode.Should().NotBeNull(); | ||
episodeCommentPost.Episode.Ids.Should().NotBeNull(); | ||
episodeCommentPost.Episode.Ids.Trakt.Should().Be(TraktPost_Tests_Common_Data.EPISODE_1.Ids.Trakt); | ||
episodeCommentPost.Episode.Ids.Imdb.Should().Be(TraktPost_Tests_Common_Data.EPISODE_1.Ids.Imdb); | ||
episodeCommentPost.Episode.Ids.Tvdb.Should().Be(TraktPost_Tests_Common_Data.EPISODE_1.Ids.Tvdb); | ||
episodeCommentPost.Episode.Ids.TvRage.Should().Be(TraktPost_Tests_Common_Data.EPISODE_1.Ids.TvRage); | ||
episodeCommentPost.Episode.Ids.Tmdb.Should().Be(TraktPost_Tests_Common_Data.EPISODE_1.Ids.Tmdb); | ||
episodeCommentPost.Sharing.Should().BeNull(); | ||
episodeCommentPost.Spoiler.Should().BeNull(); | ||
} | ||
|
||
[Fact] | ||
public void Test_TraktPost_EpisodeCommentPostBuilder_Comment_Episode_Sharing() | ||
{ | ||
ITraktEpisodeCommentPost episodeCommentPost = TraktPost.NewEpisodeCommentPost() | ||
.WithComment(TraktPost_Tests_Common_Data.VALID_COMMENT) | ||
.WithEpisode(TraktPost_Tests_Common_Data.EPISODE_1) | ||
.WithSharing(TraktPost_Tests_Common_Data.SHARING) | ||
.Build(); | ||
|
||
episodeCommentPost.Should().NotBeNull(); | ||
episodeCommentPost.Comment.Should().Be(TraktPost_Tests_Common_Data.VALID_COMMENT); | ||
episodeCommentPost.Episode.Should().NotBeNull(); | ||
episodeCommentPost.Episode.Ids.Should().NotBeNull(); | ||
episodeCommentPost.Episode.Ids.Trakt.Should().Be(TraktPost_Tests_Common_Data.EPISODE_1.Ids.Trakt); | ||
episodeCommentPost.Episode.Ids.Imdb.Should().Be(TraktPost_Tests_Common_Data.EPISODE_1.Ids.Imdb); | ||
episodeCommentPost.Episode.Ids.Tvdb.Should().Be(TraktPost_Tests_Common_Data.EPISODE_1.Ids.Tvdb); | ||
episodeCommentPost.Episode.Ids.TvRage.Should().Be(TraktPost_Tests_Common_Data.EPISODE_1.Ids.TvRage); | ||
episodeCommentPost.Episode.Ids.Tmdb.Should().Be(TraktPost_Tests_Common_Data.EPISODE_1.Ids.Tmdb); | ||
episodeCommentPost.Sharing.Should().NotBeNull(); | ||
episodeCommentPost.Sharing.Apple.Should().BeTrue(); | ||
episodeCommentPost.Sharing.Facebook.Should().BeTrue(); | ||
episodeCommentPost.Sharing.Google.Should().BeTrue(); | ||
episodeCommentPost.Sharing.Medium.Should().BeTrue(); | ||
episodeCommentPost.Sharing.Slack.Should().BeTrue(); | ||
episodeCommentPost.Sharing.Tumblr.Should().BeTrue(); | ||
episodeCommentPost.Sharing.Twitter.Should().BeTrue(); | ||
episodeCommentPost.Spoiler.Should().BeNull(); | ||
} | ||
|
||
[Fact] | ||
public void Test_TraktPost_EpisodeCommentPostBuilder_Comment_Episode_Spoiler() | ||
{ | ||
ITraktEpisodeCommentPost episodeCommentPost = TraktPost.NewEpisodeCommentPost() | ||
.WithComment(TraktPost_Tests_Common_Data.VALID_COMMENT) | ||
.WithEpisode(TraktPost_Tests_Common_Data.EPISODE_1) | ||
.WithSpoiler(true) | ||
.Build(); | ||
|
||
episodeCommentPost.Should().NotBeNull(); | ||
episodeCommentPost.Comment.Should().Be(TraktPost_Tests_Common_Data.VALID_COMMENT); | ||
episodeCommentPost.Episode.Should().NotBeNull(); | ||
episodeCommentPost.Episode.Ids.Should().NotBeNull(); | ||
episodeCommentPost.Episode.Ids.Trakt.Should().Be(TraktPost_Tests_Common_Data.EPISODE_1.Ids.Trakt); | ||
episodeCommentPost.Episode.Ids.Imdb.Should().Be(TraktPost_Tests_Common_Data.EPISODE_1.Ids.Imdb); | ||
episodeCommentPost.Episode.Ids.Tvdb.Should().Be(TraktPost_Tests_Common_Data.EPISODE_1.Ids.Tvdb); | ||
episodeCommentPost.Episode.Ids.TvRage.Should().Be(TraktPost_Tests_Common_Data.EPISODE_1.Ids.TvRage); | ||
episodeCommentPost.Episode.Ids.Tmdb.Should().Be(TraktPost_Tests_Common_Data.EPISODE_1.Ids.Tmdb); | ||
episodeCommentPost.Sharing.Should().BeNull(); | ||
episodeCommentPost.Spoiler.Should().BeTrue(); | ||
} | ||
|
||
[Fact] | ||
public void Test_TraktPost_EpisodeCommentPostBuilder_Complete() | ||
{ | ||
ITraktEpisodeCommentPost episodeCommentPost = TraktPost.NewEpisodeCommentPost() | ||
.WithComment(TraktPost_Tests_Common_Data.VALID_COMMENT) | ||
.WithEpisode(TraktPost_Tests_Common_Data.EPISODE_1) | ||
.WithSharing(TraktPost_Tests_Common_Data.SHARING) | ||
.WithSpoiler(true) | ||
.Build(); | ||
|
||
episodeCommentPost.Should().NotBeNull(); | ||
episodeCommentPost.Comment.Should().Be(TraktPost_Tests_Common_Data.VALID_COMMENT); | ||
episodeCommentPost.Episode.Should().NotBeNull(); | ||
episodeCommentPost.Episode.Ids.Should().NotBeNull(); | ||
episodeCommentPost.Episode.Ids.Trakt.Should().Be(TraktPost_Tests_Common_Data.EPISODE_1.Ids.Trakt); | ||
episodeCommentPost.Episode.Ids.Imdb.Should().Be(TraktPost_Tests_Common_Data.EPISODE_1.Ids.Imdb); | ||
episodeCommentPost.Episode.Ids.Tvdb.Should().Be(TraktPost_Tests_Common_Data.EPISODE_1.Ids.Tvdb); | ||
episodeCommentPost.Episode.Ids.TvRage.Should().Be(TraktPost_Tests_Common_Data.EPISODE_1.Ids.TvRage); | ||
episodeCommentPost.Episode.Ids.Tmdb.Should().Be(TraktPost_Tests_Common_Data.EPISODE_1.Ids.Tmdb); | ||
episodeCommentPost.Sharing.Should().NotBeNull(); | ||
episodeCommentPost.Sharing.Apple.Should().BeTrue(); | ||
episodeCommentPost.Sharing.Facebook.Should().BeTrue(); | ||
episodeCommentPost.Sharing.Google.Should().BeTrue(); | ||
episodeCommentPost.Sharing.Medium.Should().BeTrue(); | ||
episodeCommentPost.Sharing.Slack.Should().BeTrue(); | ||
episodeCommentPost.Sharing.Tumblr.Should().BeTrue(); | ||
episodeCommentPost.Sharing.Twitter.Should().BeTrue(); | ||
episodeCommentPost.Spoiler.Should().BeTrue(); | ||
} | ||
} | ||
} |
80 changes: 80 additions & 0 deletions
80
...PostBuilder.Tests/CommentPostBuilder/TraktPost_ListCommentPostBuilder_Exceptions_Tests.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
namespace TraktNet.PostBuilder.Tests | ||
{ | ||
using FluentAssertions; | ||
using System; | ||
using Trakt.NET.Tests.Utility.Traits; | ||
using TraktNet.Objects.Get.Lists; | ||
using TraktNet.Objects.Post.Comments; | ||
using Xunit; | ||
|
||
[Category("PostBuilder")] | ||
public partial class TraktPost_ListCommentPostBuilder_Tests | ||
{ | ||
[Fact] | ||
public void Test_TraktPost_ListCommentPostBuilder_WithComment_ArgumentNullException() | ||
{ | ||
Func<ITraktListCommentPost> act = () => TraktPost.NewListCommentPost() | ||
.WithComment(null) | ||
.WithList(TraktPost_Tests_Common_Data.LIST) | ||
.Build(); | ||
|
||
act.Should().Throw<ArgumentNullException>(); | ||
} | ||
|
||
[Fact] | ||
public void Test_TraktPost_ListCommentPostBuilder_WithComment_ArgumentOutOfRangeException() | ||
{ | ||
Func<ITraktListCommentPost> act = () => TraktPost.NewListCommentPost() | ||
.WithComment(TraktPost_Tests_Common_Data.INVALID_COMMENT) | ||
.WithList(TraktPost_Tests_Common_Data.LIST) | ||
.Build(); | ||
|
||
act.Should().Throw<ArgumentOutOfRangeException>(); | ||
} | ||
|
||
[Fact] | ||
public void Test_TraktPost_ListCommentPostBuilder_WithList_List_ArgumentNullException() | ||
{ | ||
Func<ITraktListCommentPost> act = () => TraktPost.NewListCommentPost() | ||
.WithComment(TraktPost_Tests_Common_Data.VALID_COMMENT) | ||
.WithList(null) | ||
.Build(); | ||
|
||
act.Should().Throw<ArgumentNullException>(); | ||
} | ||
|
||
[Fact] | ||
public void Test_TraktPost_ListCommentPostBuilder_WithList_ListIds_ArgumentNullException() | ||
{ | ||
Func<ITraktListCommentPost> act = () => TraktPost.NewListCommentPost() | ||
.WithComment(TraktPost_Tests_Common_Data.VALID_COMMENT) | ||
.WithList(new TraktList()) | ||
.Build(); | ||
|
||
act.Should().Throw<ArgumentNullException>(); | ||
} | ||
|
||
[Fact] | ||
public void Test_TraktPost_ListCommentPostBuilder_WithList_ListIds_ArgumentException() | ||
{ | ||
Func<ITraktListCommentPost> act = () => TraktPost.NewListCommentPost() | ||
.WithComment(TraktPost_Tests_Common_Data.VALID_COMMENT) | ||
.WithList(new TraktList { Ids = new TraktListIds() }) | ||
.Build(); | ||
|
||
act.Should().Throw<ArgumentException>(); | ||
} | ||
|
||
[Fact] | ||
public void Test_TraktPost_ListCommentPostBuilder_WithSharing_ArgumentNullException() | ||
{ | ||
Func<ITraktListCommentPost> act = () => TraktPost.NewListCommentPost() | ||
.WithComment(TraktPost_Tests_Common_Data.VALID_COMMENT) | ||
.WithList(TraktPost_Tests_Common_Data.LIST) | ||
.WithSharing(null) | ||
.Build(); | ||
|
||
act.Should().Throw<ArgumentNullException>(); | ||
} | ||
} | ||
} |
Oops, something went wrong.