-
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
d13a65e
commit 43d34b0
Showing
8 changed files
with
135 additions
and
71 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
62 changes: 62 additions & 0 deletions
62
...ts/Trakt.NET.Objects.Post.Tests/Checkins/Implementations/TraktEpisodeCheckinPost_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,62 @@ | ||
namespace TraktNet.Objects.Post.Tests.Checkins.Implementations | ||
{ | ||
using FluentAssertions; | ||
using System; | ||
using Trakt.NET.Tests.Utility.Traits; | ||
using TraktNet.Exceptions; | ||
using TraktNet.Objects.Get.Episodes; | ||
using TraktNet.Objects.Get.Shows; | ||
using TraktNet.Objects.Post.Checkins; | ||
using Xunit; | ||
|
||
[Category("Objects.Post.Checkins.Implementations")] | ||
public class TraktEpisodeCheckinPost_Tests | ||
{ | ||
[Fact] | ||
public void Test_TraktEpisodeCheckinPost_Validate() | ||
{ | ||
ITraktEpisodeCheckinPost episodeCheckinPost = new TraktEpisodeCheckinPost(); | ||
|
||
// Episode = null, Show = null | ||
Action act = () => episodeCheckinPost.Validate(); | ||
act.Should().Throw<TraktPostValidationException>(); | ||
|
||
// Episode != null, Show = null, Episode Ids = null | ||
episodeCheckinPost.Episode = new TraktEpisode(); | ||
act.Should().Throw<TraktPostValidationException>(); | ||
|
||
// Episode != null, Show = null, Episode Ids have no valid id | ||
episodeCheckinPost.Episode = new TraktEpisode { Ids = new TraktEpisodeIds() }; | ||
act.Should().Throw<TraktPostValidationException>(); | ||
|
||
// Episode != null, Show = null, Episode Ids = valid | ||
episodeCheckinPost.Episode = new TraktEpisode { Ids = new TraktEpisodeIds { Trakt = 1 } }; | ||
act.Should().NotThrow(); | ||
|
||
// Episode != null, Show != null, Show Ids = null | ||
episodeCheckinPost.Episode = new TraktEpisode(); | ||
episodeCheckinPost.Show = new TraktShow(); | ||
act.Should().Throw<TraktPostValidationException>(); | ||
|
||
// Episode != null, Show != null, Show Ids have no valid id | ||
episodeCheckinPost.Episode = new TraktEpisode(); | ||
episodeCheckinPost.Show = new TraktShow { Ids = new TraktShowIds() }; | ||
act.Should().Throw<TraktPostValidationException>(); | ||
|
||
// Episode != null, Show != null, Show Ids = valid, Episode Season Number not valid | ||
episodeCheckinPost.Episode = new TraktEpisode { SeasonNumber = -1, Number = 1 }; | ||
episodeCheckinPost.Show = new TraktShow { Ids = new TraktShowIds { Trakt = 1 } }; | ||
act.Should().Throw<TraktPostValidationException>(); | ||
|
||
// Episode != null, Show != null, Show Ids = valid, Episode Number not valid | ||
episodeCheckinPost.Episode = new TraktEpisode { SeasonNumber = 0, Number = 0 }; | ||
episodeCheckinPost.Show = new TraktShow { Ids = new TraktShowIds { Trakt = 1 } }; | ||
act.Should().Throw<TraktPostValidationException>(); | ||
|
||
// Episode != null, Show != null, Show Ids = valid, Episode Numbers are valid | ||
episodeCheckinPost.Episode = new TraktEpisode { SeasonNumber = 0, Number = 1 }; | ||
episodeCheckinPost.Show = new TraktShow { Ids = new TraktShowIds { Trakt = 1 } }; | ||
act.Should().NotThrow(); | ||
} | ||
} | ||
} |
36 changes: 36 additions & 0 deletions
36
...ests/Trakt.NET.Objects.Post.Tests/Checkins/Implementations/TraktMovieCheckinPost_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,36 @@ | ||
namespace TraktNet.Objects.Post.Tests.Checkins.Implementations | ||
{ | ||
using FluentAssertions; | ||
using System; | ||
using Trakt.NET.Tests.Utility.Traits; | ||
using TraktNet.Exceptions; | ||
using TraktNet.Objects.Get.Movies; | ||
using TraktNet.Objects.Post.Checkins; | ||
using Xunit; | ||
|
||
[Category("Objects.Post.Checkins.Implementations")] | ||
public class TraktMovieCheckinPost_Tests | ||
{ | ||
[Fact] | ||
public void Test_TraktMovieCheckinPost_Validate() | ||
{ | ||
ITraktMovieCheckinPost movieCheckinPost = new TraktMovieCheckinPost(); | ||
|
||
// Movie = null | ||
Action act = () => movieCheckinPost.Validate(); | ||
act.Should().Throw<TraktPostValidationException>(); | ||
|
||
// Movie Ids = null | ||
movieCheckinPost.Movie = new TraktMovie(); | ||
act.Should().Throw<TraktPostValidationException>(); | ||
|
||
// Movie IDs have no valid id | ||
movieCheckinPost.Movie = new TraktMovie { Ids = new TraktMovieIds() }; | ||
act.Should().Throw<TraktPostValidationException>(); | ||
|
||
// valid | ||
movieCheckinPost.Movie = new TraktMovie { Ids = new TraktMovieIds { Trakt = 1 } }; | ||
act.Should().NotThrow(); | ||
} | ||
} | ||
} |