public async Task Test_UserWatchingItemObjectJsonReader_Episode_ReadObject_From_Json_String_Incomplete_2()
        {
            var jsonReader = new UserWatchingItemObjectJsonReader();

            var traktUserWatchingItem = await jsonReader.ReadObjectAsync(TYPE_EPISODE_JSON_INCOMPLETE_2);

            traktUserWatchingItem.Should().NotBeNull();
            traktUserWatchingItem.StartedAt.Should().Be(DateTime.Parse("2014-10-23T06:44:02.000Z").ToUniversalTime());
            traktUserWatchingItem.ExpiresAt.Should().BeNull();
            traktUserWatchingItem.Action.Should().Be(TraktHistoryActionType.Checkin);
            traktUserWatchingItem.Type.Should().Be(TraktSyncType.Episode);
            traktUserWatchingItem.Episode.Should().NotBeNull();
            traktUserWatchingItem.Episode.SeasonNumber.Should().Be(1);
            traktUserWatchingItem.Episode.Number.Should().Be(1);
            traktUserWatchingItem.Episode.Title.Should().Be("Winter Is Coming");
            traktUserWatchingItem.Episode.Ids.Should().NotBeNull();
            traktUserWatchingItem.Episode.Ids.Trakt.Should().Be(73640U);
            traktUserWatchingItem.Episode.Ids.Tvdb.Should().Be(3254641U);
            traktUserWatchingItem.Episode.Ids.Imdb.Should().Be("tt1480055");
            traktUserWatchingItem.Episode.Ids.Tmdb.Should().Be(63056U);
            traktUserWatchingItem.Episode.Ids.TvRage.Should().Be(1065008299U);
            traktUserWatchingItem.Show.Should().NotBeNull();
            traktUserWatchingItem.Show.Title.Should().Be("Game of Thrones");
            traktUserWatchingItem.Show.Year.Should().Be(2011);
            traktUserWatchingItem.Show.Ids.Should().NotBeNull();
            traktUserWatchingItem.Show.Ids.Trakt.Should().Be(1390U);
            traktUserWatchingItem.Show.Ids.Slug.Should().Be("game-of-thrones");
            traktUserWatchingItem.Show.Ids.Tvdb.Should().Be(121361U);
            traktUserWatchingItem.Show.Ids.Imdb.Should().Be("tt0944947");
            traktUserWatchingItem.Show.Ids.Tmdb.Should().Be(1399U);
            traktUserWatchingItem.Show.Ids.TvRage.Should().Be(24493U);

            traktUserWatchingItem.Movie.Should().BeNull();
        }
Esempio n. 2
0
        public async Task Test_UserWatchingItemObjectJsonReader_Episode_ReadObject_From_JsonReader_Not_Valid_5()
        {
            var traktJsonReader = new UserWatchingItemObjectJsonReader();

            using (var reader = new StringReader(TYPE_EPISODE_JSON_NOT_VALID_5))
                using (var jsonReader = new JsonTextReader(reader))
                {
                    var traktUserWatchingItem = await traktJsonReader.ReadObjectAsync(jsonReader);

                    traktUserWatchingItem.Should().NotBeNull();
                    traktUserWatchingItem.StartedAt.Should().Be(DateTime.Parse("2014-10-23T06:44:02.000Z").ToUniversalTime());
                    traktUserWatchingItem.ExpiresAt.Should().Be(DateTime.Parse("2014-10-23T08:36:02.000Z").ToUniversalTime());
                    traktUserWatchingItem.Action.Should().Be(TraktHistoryActionType.Checkin);
                    traktUserWatchingItem.Type.Should().Be(TraktSyncType.Episode);
                    traktUserWatchingItem.Episode.Should().BeNull();
                    traktUserWatchingItem.Show.Should().NotBeNull();
                    traktUserWatchingItem.Show.Title.Should().Be("Game of Thrones");
                    traktUserWatchingItem.Show.Year.Should().Be(2011);
                    traktUserWatchingItem.Show.Ids.Should().NotBeNull();
                    traktUserWatchingItem.Show.Ids.Trakt.Should().Be(1390U);
                    traktUserWatchingItem.Show.Ids.Slug.Should().Be("game-of-thrones");
                    traktUserWatchingItem.Show.Ids.Tvdb.Should().Be(121361U);
                    traktUserWatchingItem.Show.Ids.Imdb.Should().Be("tt0944947");
                    traktUserWatchingItem.Show.Ids.Tmdb.Should().Be(1399U);
                    traktUserWatchingItem.Show.Ids.TvRage.Should().Be(24493U);

                    traktUserWatchingItem.Movie.Should().BeNull();
                }
        }
        public async Task Test_UserWatchingItemObjectJsonReader_Movie_ReadObject_From_JsonReader_Incomplete_10()
        {
            var traktJsonReader = new UserWatchingItemObjectJsonReader();

            using (var reader = new StringReader(TYPE_MOVIE_JSON_INCOMPLETE_10))
                using (var jsonReader = new JsonTextReader(reader))
                {
                    var traktUserWatchingItem = await traktJsonReader.ReadObjectAsync(jsonReader);

                    traktUserWatchingItem.Should().NotBeNull();
                    traktUserWatchingItem.StartedAt.Should().BeNull();
                    traktUserWatchingItem.ExpiresAt.Should().BeNull();
                    traktUserWatchingItem.Action.Should().BeNull();
                    traktUserWatchingItem.Type.Should().BeNull();
                    traktUserWatchingItem.Movie.Should().NotBeNull();
                    traktUserWatchingItem.Movie.Title.Should().Be("Star Wars: The Force Awakens");
                    traktUserWatchingItem.Movie.Year.Should().Be(2015);
                    traktUserWatchingItem.Movie.Ids.Should().NotBeNull();
                    traktUserWatchingItem.Movie.Ids.Trakt.Should().Be(94024U);
                    traktUserWatchingItem.Movie.Ids.Slug.Should().Be("star-wars-the-force-awakens-2015");
                    traktUserWatchingItem.Movie.Ids.Imdb.Should().Be("tt2488496");
                    traktUserWatchingItem.Movie.Ids.Tmdb.Should().Be(140607U);

                    traktUserWatchingItem.Show.Should().BeNull();
                    traktUserWatchingItem.Episode.Should().BeNull();
                }
        }
        public async Task Test_TraktUserWatchingItem_With_Type_Movie_From_Full_Json()
        {
            var jsonReader = new UserWatchingItemObjectJsonReader();
            var watchingItem = await jsonReader.ReadObjectAsync(TYPE_MOVIE_FULL_JSON) as TraktUserWatchingItem;

            watchingItem.Should().NotBeNull();
            watchingItem.StartedAt.Should().Be(DateTime.Parse("2014-10-23T06:44:02.000Z").ToUniversalTime());
            watchingItem.ExpiresAt.Should().Be(DateTime.Parse("2014-10-23T08:36:02.000Z").ToUniversalTime());
            watchingItem.Action.Should().Be(TraktHistoryActionType.Checkin);
            watchingItem.Type.Should().Be(TraktSyncType.Movie);
            watchingItem.Movie.Should().NotBeNull();
            watchingItem.Movie.Title.Should().Be("Star Wars: The Force Awakens");
            watchingItem.Movie.Year.Should().Be(2015);
            watchingItem.Movie.Ids.Should().NotBeNull();
            watchingItem.Movie.Ids.Trakt.Should().Be(94024U);
            watchingItem.Movie.Ids.Slug.Should().Be("star-wars-the-force-awakens-2015");
            watchingItem.Movie.Ids.Imdb.Should().Be("tt2488496");
            watchingItem.Movie.Ids.Tmdb.Should().Be(140607U);
            watchingItem.Movie.Tagline.Should().Be("Every generation has a story.");
            watchingItem.Movie.Overview.Should().Be("Thirty years after defeating the Galactic Empire, Han Solo and his allies face a new threat from the evil Kylo Ren and his army of Stormtroopers.");
            watchingItem.Movie.Released.Should().Be(DateTime.Parse("2015-12-18"));
            watchingItem.Movie.Runtime.Should().Be(136);
            watchingItem.Movie.UpdatedAt.Should().Be(DateTime.Parse("2016-03-31T09:01:59Z").ToUniversalTime());
            watchingItem.Movie.Trailer.Should().Be("http://youtube.com/watch?v=uwa7N0ShN2U");
            watchingItem.Movie.Homepage.Should().Be("http://www.starwars.com/films/star-wars-episode-vii");
            watchingItem.Movie.Rating.Should().Be(8.31988f);
            watchingItem.Movie.Votes.Should().Be(9338);
            watchingItem.Movie.LanguageCode.Should().Be("en");
            watchingItem.Movie.AvailableTranslationLanguageCodes.Should().NotBeNull().And.HaveCount(4).And.Contain("en", "de", "en", "it");
            watchingItem.Movie.Genres.Should().NotBeNull().And.HaveCount(4).And.Contain("action", "adventure", "fantasy", "science-fiction");
            watchingItem.Movie.Certification.Should().Be("PG-13");
            watchingItem.Show.Should().BeNull();
            watchingItem.Episode.Should().BeNull();
        }
Esempio n. 5
0
        public async Task Test_UserWatchingItemObjectJsonReader_Episode_ReadObject_From_JsonReader_Not_Valid_6()
        {
            var traktJsonReader = new UserWatchingItemObjectJsonReader();

            using (var reader = new StringReader(TYPE_EPISODE_JSON_NOT_VALID_6))
                using (var jsonReader = new JsonTextReader(reader))
                {
                    var traktUserWatchingItem = await traktJsonReader.ReadObjectAsync(jsonReader);

                    traktUserWatchingItem.Should().NotBeNull();
                    traktUserWatchingItem.StartedAt.Should().Be(DateTime.Parse("2014-10-23T06:44:02.000Z").ToUniversalTime());
                    traktUserWatchingItem.ExpiresAt.Should().Be(DateTime.Parse("2014-10-23T08:36:02.000Z").ToUniversalTime());
                    traktUserWatchingItem.Action.Should().Be(TraktHistoryActionType.Checkin);
                    traktUserWatchingItem.Type.Should().Be(TraktSyncType.Episode);
                    traktUserWatchingItem.Episode.Should().NotBeNull();
                    traktUserWatchingItem.Episode.SeasonNumber.Should().Be(1);
                    traktUserWatchingItem.Episode.Number.Should().Be(1);
                    traktUserWatchingItem.Episode.Title.Should().Be("Winter Is Coming");
                    traktUserWatchingItem.Episode.Ids.Should().NotBeNull();
                    traktUserWatchingItem.Episode.Ids.Trakt.Should().Be(73640U);
                    traktUserWatchingItem.Episode.Ids.Tvdb.Should().Be(3254641U);
                    traktUserWatchingItem.Episode.Ids.Imdb.Should().Be("tt1480055");
                    traktUserWatchingItem.Episode.Ids.Tmdb.Should().Be(63056U);
                    traktUserWatchingItem.Episode.Ids.TvRage.Should().Be(1065008299U);
                    traktUserWatchingItem.Show.Should().BeNull();
                    traktUserWatchingItem.Movie.Should().BeNull();
                }
        }
        public async Task Test_UserWatchingItemObjectJsonReader_Movie_ReadObject_From_Stream_Incomplete_3()
        {
            var jsonReadeer = new UserWatchingItemObjectJsonReader();

            using (var stream = TYPE_MOVIE_JSON_INCOMPLETE_3.ToStream())
            {
                var traktUserWatchingItem = await jsonReadeer.ReadObjectAsync(stream);

                traktUserWatchingItem.Should().NotBeNull();
                traktUserWatchingItem.StartedAt.Should().Be(DateTime.Parse("2014-10-23T06:44:02.000Z").ToUniversalTime());
                traktUserWatchingItem.ExpiresAt.Should().Be(DateTime.Parse("2014-10-23T08:36:02.000Z").ToUniversalTime());
                traktUserWatchingItem.Action.Should().BeNull();
                traktUserWatchingItem.Type.Should().Be(TraktSyncType.Movie);
                traktUserWatchingItem.Movie.Should().NotBeNull();
                traktUserWatchingItem.Movie.Title.Should().Be("Star Wars: The Force Awakens");
                traktUserWatchingItem.Movie.Year.Should().Be(2015);
                traktUserWatchingItem.Movie.Ids.Should().NotBeNull();
                traktUserWatchingItem.Movie.Ids.Trakt.Should().Be(94024U);
                traktUserWatchingItem.Movie.Ids.Slug.Should().Be("star-wars-the-force-awakens-2015");
                traktUserWatchingItem.Movie.Ids.Imdb.Should().Be("tt2488496");
                traktUserWatchingItem.Movie.Ids.Tmdb.Should().Be(140607U);

                traktUserWatchingItem.Show.Should().BeNull();
                traktUserWatchingItem.Episode.Should().BeNull();
            }
        }
        public async Task Test_TraktUserWatchingItem_With_Type_Movie_From_Minimal_Json()
        {
            var jsonReader = new UserWatchingItemObjectJsonReader();
            var watchingItem = await jsonReader.ReadObjectAsync(TYPE_MOVIE_MINIMAL_JSON) as TraktUserWatchingItem;

            watchingItem.Should().NotBeNull();
            watchingItem.StartedAt.Should().Be(DateTime.Parse("2014-10-23T06:44:02.000Z").ToUniversalTime());
            watchingItem.ExpiresAt.Should().Be(DateTime.Parse("2014-10-23T08:36:02.000Z").ToUniversalTime());
            watchingItem.Action.Should().Be(TraktHistoryActionType.Checkin);
            watchingItem.Type.Should().Be(TraktSyncType.Movie);
            watchingItem.Movie.Should().NotBeNull();
            watchingItem.Movie.Title.Should().Be("Star Wars: The Force Awakens");
            watchingItem.Movie.Year.Should().Be(2015);
            watchingItem.Movie.Ids.Should().NotBeNull();
            watchingItem.Movie.Ids.Trakt.Should().Be(94024U);
            watchingItem.Movie.Ids.Slug.Should().Be("star-wars-the-force-awakens-2015");
            watchingItem.Movie.Ids.Imdb.Should().Be("tt2488496");
            watchingItem.Movie.Ids.Tmdb.Should().Be(140607U);
            watchingItem.Movie.Tagline.Should().BeNullOrEmpty();
            watchingItem.Movie.Overview.Should().BeNullOrEmpty();
            watchingItem.Movie.Released.Should().NotHaveValue();
            watchingItem.Movie.Runtime.Should().NotHaveValue();
            watchingItem.Movie.UpdatedAt.Should().NotHaveValue();
            watchingItem.Movie.Trailer.Should().BeNullOrEmpty();
            watchingItem.Movie.Homepage.Should().BeNullOrEmpty();
            watchingItem.Movie.Rating.Should().NotHaveValue();
            watchingItem.Movie.Votes.Should().NotHaveValue();
            watchingItem.Movie.LanguageCode.Should().BeNullOrEmpty();
            watchingItem.Movie.AvailableTranslationLanguageCodes.Should().BeNull();
            watchingItem.Movie.Genres.Should().BeNull();
            watchingItem.Movie.Certification.Should().BeNullOrEmpty();
            watchingItem.Show.Should().BeNull();
            watchingItem.Episode.Should().BeNull();
        }
        public void Test_UserWatchingItemObjectJsonReader_ReadObject_From_Stream_Null()
        {
            var jsonReader = new UserWatchingItemObjectJsonReader();
            Func <Task <ITraktUserWatchingItem> > traktUserWatchingItem = () => jsonReader.ReadObjectAsync(default(Stream));

            traktUserWatchingItem.Should().Throw <ArgumentNullException>();
        }
        public async Task Test_UserWatchingItemObjectJsonReader_Movie_ReadObject_From_JsonReader_Not_Valid_4()
        {
            var traktJsonReader = new UserWatchingItemObjectJsonReader();

            using (var reader = new StringReader(TYPE_MOVIE_JSON_NOT_VALID_4))
                using (var jsonReader = new JsonTextReader(reader))
                {
                    var traktUserWatchingItem = await traktJsonReader.ReadObjectAsync(jsonReader);

                    traktUserWatchingItem.Should().NotBeNull();
                    traktUserWatchingItem.StartedAt.Should().Be(DateTime.Parse("2014-10-23T06:44:02.000Z").ToUniversalTime());
                    traktUserWatchingItem.ExpiresAt.Should().Be(DateTime.Parse("2014-10-23T08:36:02.000Z").ToUniversalTime());
                    traktUserWatchingItem.Action.Should().Be(TraktHistoryActionType.Checkin);
                    traktUserWatchingItem.Type.Should().BeNull();
                    traktUserWatchingItem.Movie.Should().NotBeNull();
                    traktUserWatchingItem.Movie.Title.Should().Be("Star Wars: The Force Awakens");
                    traktUserWatchingItem.Movie.Year.Should().Be(2015);
                    traktUserWatchingItem.Movie.Ids.Should().NotBeNull();
                    traktUserWatchingItem.Movie.Ids.Trakt.Should().Be(94024U);
                    traktUserWatchingItem.Movie.Ids.Slug.Should().Be("star-wars-the-force-awakens-2015");
                    traktUserWatchingItem.Movie.Ids.Imdb.Should().Be("tt2488496");
                    traktUserWatchingItem.Movie.Ids.Tmdb.Should().Be(140607U);

                    traktUserWatchingItem.Show.Should().BeNull();
                    traktUserWatchingItem.Episode.Should().BeNull();
                }
        }
Esempio n. 10
0
        public async Task Test_UserWatchingItemObjectJsonReader_Episode_ReadObject_From_JsonReader_Incomplete_11()
        {
            var traktJsonReader = new UserWatchingItemObjectJsonReader();

            using (var reader = new StringReader(TYPE_EPISODE_JSON_INCOMPLETE_11))
                using (var jsonReader = new JsonTextReader(reader))
                {
                    var traktUserWatchingItem = await traktJsonReader.ReadObjectAsync(jsonReader);

                    traktUserWatchingItem.Should().NotBeNull();
                    traktUserWatchingItem.StartedAt.Should().BeNull();
                    traktUserWatchingItem.ExpiresAt.Should().BeNull();
                    traktUserWatchingItem.Action.Should().BeNull();
                    traktUserWatchingItem.Type.Should().BeNull();
                    traktUserWatchingItem.Episode.Should().NotBeNull();
                    traktUserWatchingItem.Episode.SeasonNumber.Should().Be(1);
                    traktUserWatchingItem.Episode.Number.Should().Be(1);
                    traktUserWatchingItem.Episode.Title.Should().Be("Winter Is Coming");
                    traktUserWatchingItem.Episode.Ids.Should().NotBeNull();
                    traktUserWatchingItem.Episode.Ids.Trakt.Should().Be(73640U);
                    traktUserWatchingItem.Episode.Ids.Tvdb.Should().Be(3254641U);
                    traktUserWatchingItem.Episode.Ids.Imdb.Should().Be("tt1480055");
                    traktUserWatchingItem.Episode.Ids.Tmdb.Should().Be(63056U);
                    traktUserWatchingItem.Episode.Ids.TvRage.Should().Be(1065008299U);
                    traktUserWatchingItem.Show.Should().BeNull();
                    traktUserWatchingItem.Movie.Should().BeNull();
                }
        }
Esempio n. 11
0
        public async Task Test_UserWatchingItemObjectJsonReader_Episode_ReadObject_From_JsonReader_Incomplete_12()
        {
            var traktJsonReader = new UserWatchingItemObjectJsonReader();

            using (var reader = new StringReader(TYPE_EPISODE_JSON_INCOMPLETE_12))
                using (var jsonReader = new JsonTextReader(reader))
                {
                    var traktUserWatchingItem = await traktJsonReader.ReadObjectAsync(jsonReader);

                    traktUserWatchingItem.Should().NotBeNull();
                    traktUserWatchingItem.StartedAt.Should().BeNull();
                    traktUserWatchingItem.ExpiresAt.Should().BeNull();
                    traktUserWatchingItem.Action.Should().BeNull();
                    traktUserWatchingItem.Type.Should().BeNull();
                    traktUserWatchingItem.Episode.Should().BeNull();
                    traktUserWatchingItem.Show.Should().NotBeNull();
                    traktUserWatchingItem.Show.Title.Should().Be("Game of Thrones");
                    traktUserWatchingItem.Show.Year.Should().Be(2011);
                    traktUserWatchingItem.Show.Ids.Should().NotBeNull();
                    traktUserWatchingItem.Show.Ids.Trakt.Should().Be(1390U);
                    traktUserWatchingItem.Show.Ids.Slug.Should().Be("game-of-thrones");
                    traktUserWatchingItem.Show.Ids.Tvdb.Should().Be(121361U);
                    traktUserWatchingItem.Show.Ids.Imdb.Should().Be("tt0944947");
                    traktUserWatchingItem.Show.Ids.Tmdb.Should().Be(1399U);
                    traktUserWatchingItem.Show.Ids.TvRage.Should().Be(24493U);

                    traktUserWatchingItem.Movie.Should().BeNull();
                }
        }
        public async Task Test_TraktUserWatchingItem_With_Type_Episode_From_Minimal_Json()
        {
            var jsonReader = new UserWatchingItemObjectJsonReader();
            var watchingItem = await jsonReader.ReadObjectAsync(TYPE_EPISODE_MINIMAL_JSON) as TraktUserWatchingItem;

            watchingItem.Should().NotBeNull();
            watchingItem.StartedAt.Should().Be(DateTime.Parse("2014-10-23T06:44:02.000Z").ToUniversalTime());
            watchingItem.ExpiresAt.Should().Be(DateTime.Parse("2014-10-23T08:36:02.000Z").ToUniversalTime());
            watchingItem.Action.Should().Be(TraktHistoryActionType.Checkin);
            watchingItem.Type.Should().Be(TraktSyncType.Episode);
            watchingItem.Movie.Should().BeNull();
            watchingItem.Show.Should().NotBeNull();
            watchingItem.Show.Title.Should().Be("Game of Thrones");
            watchingItem.Show.Year.Should().Be(2011);
            watchingItem.Show.Airs.Should().BeNull();
            watchingItem.Show.AvailableTranslationLanguageCodes.Should().BeNull();
            watchingItem.Show.Ids.Should().NotBeNull();
            watchingItem.Show.Ids.Trakt.Should().Be(1390U);
            watchingItem.Show.Ids.Slug.Should().Be("game-of-thrones");
            watchingItem.Show.Ids.Tvdb.Should().Be(121361U);
            watchingItem.Show.Ids.Imdb.Should().Be("tt0944947");
            watchingItem.Show.Ids.Tmdb.Should().Be(1399U);
            watchingItem.Show.Ids.TvRage.Should().Be(24493U);
            watchingItem.Show.Genres.Should().BeNull();
            watchingItem.Show.Seasons.Should().BeNull();
            watchingItem.Show.Overview.Should().BeNullOrEmpty();
            watchingItem.Show.FirstAired.Should().NotHaveValue();
            watchingItem.Show.Runtime.Should().NotHaveValue();
            watchingItem.Show.Certification.Should().BeNullOrEmpty();
            watchingItem.Show.Network.Should().BeNullOrEmpty();
            watchingItem.Show.CountryCode.Should().BeNullOrEmpty();
            watchingItem.Show.UpdatedAt.Should().NotHaveValue();
            watchingItem.Show.Trailer.Should().BeNullOrEmpty();
            watchingItem.Show.Homepage.Should().BeNullOrEmpty();
            watchingItem.Show.Status.Should().BeNull();
            watchingItem.Show.Rating.Should().NotHaveValue();
            watchingItem.Show.Votes.Should().NotHaveValue();
            watchingItem.Show.LanguageCode.Should().BeNullOrEmpty();
            watchingItem.Show.AiredEpisodes.Should().NotHaveValue();
            watchingItem.Episode.Should().NotBeNull();
            watchingItem.Episode.SeasonNumber.Should().Be(1);
            watchingItem.Episode.Number.Should().Be(1);
            watchingItem.Episode.Title.Should().Be("Winter Is Coming");
            watchingItem.Episode.Ids.Should().NotBeNull();
            watchingItem.Episode.Ids.Trakt.Should().Be(73640U);
            watchingItem.Episode.Ids.Tvdb.Should().Be(3254641U);
            watchingItem.Episode.Ids.Imdb.Should().Be("tt1480055");
            watchingItem.Episode.Ids.Tmdb.Should().Be(63056U);
            watchingItem.Episode.Ids.TvRage.Should().Be(1065008299U);
            watchingItem.Episode.NumberAbsolute.Should().NotHaveValue();
            watchingItem.Episode.Overview.Should().BeNullOrEmpty();
            watchingItem.Episode.Runtime.Should().NotHaveValue();
            watchingItem.Episode.Rating.Should().NotHaveValue();
            watchingItem.Episode.Votes.Should().NotHaveValue();
            watchingItem.Episode.FirstAired.Should().NotHaveValue();
            watchingItem.Episode.UpdatedAt.Should().NotHaveValue();
            watchingItem.Episode.AvailableTranslationLanguageCodes.Should().BeNull();
            watchingItem.Episode.Translations.Should().BeNull();
        }
Esempio n. 13
0
        public async Task Test_UserWatchingItemObjectJsonReader_ReadObject_From_Json_String_Empty()
        {
            var jsonReader = new UserWatchingItemObjectJsonReader();

            var traktUserWatchingItem = await jsonReader.ReadObjectAsync(string.Empty);

            traktUserWatchingItem.Should().BeNull();
        }
        public async Task Test_UserWatchingItemObjectJsonReader_ReadObject_From_JsonReader_Null()
        {
            var traktJsonReader = new UserWatchingItemObjectJsonReader();

            var traktUserWatchingItem = await traktJsonReader.ReadObjectAsync(default(JsonTextReader));

            traktUserWatchingItem.Should().BeNull();
        }
Esempio n. 15
0
        public async Task Test_UserWatchingItemObjectJsonReader_ReadObject_From_Stream_Null()
        {
            var jsonReader = new UserWatchingItemObjectJsonReader();

            var traktUserWatchingItem = await jsonReader.ReadObjectAsync(default(Stream));

            traktUserWatchingItem.Should().BeNull();
        }
Esempio n. 16
0
        public async Task Test_UserWatchingItemObjectJsonReader_ReadObject_From_Stream_Empty()
        {
            var jsonReader = new UserWatchingItemObjectJsonReader();

            using (var stream = string.Empty.ToStream())
            {
                var traktUserWatchingItem = await jsonReader.ReadObjectAsync(stream);

                traktUserWatchingItem.Should().BeNull();
            }
        }
        public async Task Test_UserWatchingItemObjectJsonReader_ReadObject_From_JsonReader_Empty()
        {
            var traktJsonReader = new UserWatchingItemObjectJsonReader();

            using (var reader = new StringReader(string.Empty))
                using (var jsonReader = new JsonTextReader(reader))
                {
                    var traktUserWatchingItem = await traktJsonReader.ReadObjectAsync(jsonReader);

                    traktUserWatchingItem.Should().BeNull();
                }
        }
Esempio n. 18
0
        public async Task Test_UserWatchingItemObjectJsonReader_Movie_ReadObject_From_Json_String_Incomplete_7()
        {
            var jsonReader = new UserWatchingItemObjectJsonReader();

            var traktUserWatchingItem = await jsonReader.ReadObjectAsync(TYPE_MOVIE_JSON_INCOMPLETE_7);

            traktUserWatchingItem.Should().NotBeNull();
            traktUserWatchingItem.StartedAt.Should().BeNull();
            traktUserWatchingItem.ExpiresAt.Should().Be(DateTime.Parse("2014-10-23T08:36:02.000Z").ToUniversalTime());
            traktUserWatchingItem.Action.Should().BeNull();
            traktUserWatchingItem.Type.Should().BeNull();
            traktUserWatchingItem.Movie.Should().BeNull();
            traktUserWatchingItem.Show.Should().BeNull();
            traktUserWatchingItem.Episode.Should().BeNull();
        }
Esempio n. 19
0
        public async Task Test_UserWatchingItemObjectJsonReader_Movie_ReadObject_From_Json_String_Not_Valid_5()
        {
            var jsonReader = new UserWatchingItemObjectJsonReader();

            var traktUserWatchingItem = await jsonReader.ReadObjectAsync(TYPE_MOVIE_JSON_NOT_VALID_5);

            traktUserWatchingItem.Should().NotBeNull();
            traktUserWatchingItem.StartedAt.Should().Be(DateTime.Parse("2014-10-23T06:44:02.000Z").ToUniversalTime());
            traktUserWatchingItem.ExpiresAt.Should().Be(DateTime.Parse("2014-10-23T08:36:02.000Z").ToUniversalTime());
            traktUserWatchingItem.Action.Should().Be(TraktHistoryActionType.Checkin);
            traktUserWatchingItem.Type.Should().Be(TraktSyncType.Movie);
            traktUserWatchingItem.Movie.Should().BeNull();
            traktUserWatchingItem.Show.Should().BeNull();
            traktUserWatchingItem.Episode.Should().BeNull();
        }
Esempio n. 20
0
        public async Task Test_UserWatchingItemObjectJsonReader_Movie_ReadObject_From_Json_String_Not_Valid_6()
        {
            var jsonReader = new UserWatchingItemObjectJsonReader();

            var traktUserWatchingItem = await jsonReader.ReadObjectAsync(TYPE_MOVIE_JSON_NOT_VALID_6);

            traktUserWatchingItem.Should().NotBeNull();
            traktUserWatchingItem.StartedAt.Should().BeNull();
            traktUserWatchingItem.ExpiresAt.Should().BeNull();
            traktUserWatchingItem.Action.Should().BeNull();
            traktUserWatchingItem.Type.Should().BeNull();
            traktUserWatchingItem.Movie.Should().BeNull();
            traktUserWatchingItem.Show.Should().BeNull();
            traktUserWatchingItem.Episode.Should().BeNull();
        }
Esempio n. 21
0
        public async Task Test_UserWatchingItemObjectJsonReader_Movie_ReadObject_From_Json_String_Incomplete_9()
        {
            var jsonReader = new UserWatchingItemObjectJsonReader();

            var traktUserWatchingItem = await jsonReader.ReadObjectAsync(TYPE_MOVIE_JSON_INCOMPLETE_9);

            traktUserWatchingItem.Should().NotBeNull();
            traktUserWatchingItem.StartedAt.Should().BeNull();
            traktUserWatchingItem.ExpiresAt.Should().BeNull();
            traktUserWatchingItem.Action.Should().BeNull();
            traktUserWatchingItem.Type.Should().Be(TraktSyncType.Movie);
            traktUserWatchingItem.Movie.Should().BeNull();
            traktUserWatchingItem.Show.Should().BeNull();
            traktUserWatchingItem.Episode.Should().BeNull();
        }
        public async Task Test_UserWatchingItemObjectJsonReader_Movie_ReadObject_From_Stream_Incomplete_8()
        {
            var jsonReadeer = new UserWatchingItemObjectJsonReader();

            using (var stream = TYPE_MOVIE_JSON_INCOMPLETE_8.ToStream())
            {
                var traktUserWatchingItem = await jsonReadeer.ReadObjectAsync(stream);

                traktUserWatchingItem.Should().NotBeNull();
                traktUserWatchingItem.StartedAt.Should().BeNull();
                traktUserWatchingItem.ExpiresAt.Should().BeNull();
                traktUserWatchingItem.Action.Should().Be(TraktHistoryActionType.Checkin);
                traktUserWatchingItem.Type.Should().BeNull();
                traktUserWatchingItem.Movie.Should().BeNull();
                traktUserWatchingItem.Show.Should().BeNull();
                traktUserWatchingItem.Episode.Should().BeNull();
            }
        }
        public async Task Test_UserWatchingItemObjectJsonReader_Episode_ReadObject_From_Stream_Not_Valid_7()
        {
            var jsonReader = new UserWatchingItemObjectJsonReader();

            using (var stream = TYPE_EPISODE_JSON_NOT_VALID_7.ToStream())
            {
                var traktUserWatchingItem = await jsonReader.ReadObjectAsync(stream);

                traktUserWatchingItem.Should().NotBeNull();
                traktUserWatchingItem.StartedAt.Should().BeNull();
                traktUserWatchingItem.ExpiresAt.Should().BeNull();
                traktUserWatchingItem.Action.Should().BeNull();
                traktUserWatchingItem.Type.Should().BeNull();
                traktUserWatchingItem.Episode.Should().BeNull();
                traktUserWatchingItem.Show.Should().BeNull();
                traktUserWatchingItem.Movie.Should().BeNull();
            }
        }
        public async Task Test_UserWatchingItemObjectJsonReader_Episode_ReadObject_From_Stream_Incomplete_8()
        {
            var jsonReader = new UserWatchingItemObjectJsonReader();

            using (var stream = TYPE_EPISODE_JSON_INCOMPLETE_8.ToStream())
            {
                var traktUserWatchingItem = await jsonReader.ReadObjectAsync(stream);

                traktUserWatchingItem.Should().NotBeNull();
                traktUserWatchingItem.StartedAt.Should().BeNull();
                traktUserWatchingItem.ExpiresAt.Should().Be(DateTime.Parse("2014-10-23T08:36:02.000Z").ToUniversalTime());
                traktUserWatchingItem.Action.Should().BeNull();
                traktUserWatchingItem.Type.Should().BeNull();
                traktUserWatchingItem.Episode.Should().BeNull();
                traktUserWatchingItem.Show.Should().BeNull();
                traktUserWatchingItem.Movie.Should().BeNull();
            }
        }
        public async Task Test_UserWatchingItemObjectJsonReader_Episode_ReadObject_From_Stream_Incomplete_10()
        {
            var jsonReader = new UserWatchingItemObjectJsonReader();

            using (var stream = TYPE_EPISODE_JSON_INCOMPLETE_10.ToStream())
            {
                var traktUserWatchingItem = await jsonReader.ReadObjectAsync(stream);

                traktUserWatchingItem.Should().NotBeNull();
                traktUserWatchingItem.StartedAt.Should().BeNull();
                traktUserWatchingItem.ExpiresAt.Should().BeNull();
                traktUserWatchingItem.Action.Should().BeNull();
                traktUserWatchingItem.Type.Should().Be(TraktSyncType.Episode);
                traktUserWatchingItem.Episode.Should().BeNull();
                traktUserWatchingItem.Show.Should().BeNull();
                traktUserWatchingItem.Movie.Should().BeNull();
            }
        }
Esempio n. 26
0
        public async Task Test_UserWatchingItemObjectJsonReader_Episode_ReadObject_From_JsonReader_Incomplete_10()
        {
            var traktJsonReader = new UserWatchingItemObjectJsonReader();

            using (var reader = new StringReader(TYPE_EPISODE_JSON_INCOMPLETE_10))
                using (var jsonReader = new JsonTextReader(reader))
                {
                    var traktUserWatchingItem = await traktJsonReader.ReadObjectAsync(jsonReader);

                    traktUserWatchingItem.Should().NotBeNull();
                    traktUserWatchingItem.StartedAt.Should().BeNull();
                    traktUserWatchingItem.ExpiresAt.Should().BeNull();
                    traktUserWatchingItem.Action.Should().BeNull();
                    traktUserWatchingItem.Type.Should().Be(TraktSyncType.Episode);
                    traktUserWatchingItem.Episode.Should().BeNull();
                    traktUserWatchingItem.Show.Should().BeNull();
                    traktUserWatchingItem.Movie.Should().BeNull();
                }
        }
Esempio n. 27
0
        public async Task Test_UserWatchingItemObjectJsonReader_Episode_ReadObject_From_JsonReader_Incomplete_7()
        {
            var traktJsonReader = new UserWatchingItemObjectJsonReader();

            using (var reader = new StringReader(TYPE_EPISODE_JSON_INCOMPLETE_7))
                using (var jsonReader = new JsonTextReader(reader))
                {
                    var traktUserWatchingItem = await traktJsonReader.ReadObjectAsync(jsonReader);

                    traktUserWatchingItem.Should().NotBeNull();
                    traktUserWatchingItem.StartedAt.Should().Be(DateTime.Parse("2014-10-23T06:44:02.000Z").ToUniversalTime());
                    traktUserWatchingItem.ExpiresAt.Should().BeNull();
                    traktUserWatchingItem.Action.Should().BeNull();
                    traktUserWatchingItem.Type.Should().BeNull();
                    traktUserWatchingItem.Episode.Should().BeNull();
                    traktUserWatchingItem.Show.Should().BeNull();
                    traktUserWatchingItem.Movie.Should().BeNull();
                }
        }
Esempio n. 28
0
        public async Task Test_UserWatchingItemObjectJsonReader_Episode_ReadObject_From_JsonReader_Not_Valid_7()
        {
            var traktJsonReader = new UserWatchingItemObjectJsonReader();

            using (var reader = new StringReader(TYPE_EPISODE_JSON_NOT_VALID_7))
                using (var jsonReader = new JsonTextReader(reader))
                {
                    var traktUserWatchingItem = await traktJsonReader.ReadObjectAsync(jsonReader);

                    traktUserWatchingItem.Should().NotBeNull();
                    traktUserWatchingItem.StartedAt.Should().BeNull();
                    traktUserWatchingItem.ExpiresAt.Should().BeNull();
                    traktUserWatchingItem.Action.Should().BeNull();
                    traktUserWatchingItem.Type.Should().BeNull();
                    traktUserWatchingItem.Episode.Should().BeNull();
                    traktUserWatchingItem.Show.Should().BeNull();
                    traktUserWatchingItem.Movie.Should().BeNull();
                }
        }
        public async Task Test_UserWatchingItemObjectJsonReader_Episode_ReadObject_From_Stream_Not_Valid_3()
        {
            var jsonReader = new UserWatchingItemObjectJsonReader();

            using (var stream = TYPE_EPISODE_JSON_NOT_VALID_3.ToStream())
            {
                var traktUserWatchingItem = await jsonReader.ReadObjectAsync(stream);

                traktUserWatchingItem.Should().NotBeNull();
                traktUserWatchingItem.StartedAt.Should().Be(DateTime.Parse("2014-10-23T06:44:02.000Z").ToUniversalTime());
                traktUserWatchingItem.ExpiresAt.Should().Be(DateTime.Parse("2014-10-23T08:36:02.000Z").ToUniversalTime());
                traktUserWatchingItem.Action.Should().BeNull();
                traktUserWatchingItem.Type.Should().Be(TraktSyncType.Episode);
                traktUserWatchingItem.Episode.Should().NotBeNull();
                traktUserWatchingItem.Episode.SeasonNumber.Should().Be(1);
                traktUserWatchingItem.Episode.Number.Should().Be(1);
                traktUserWatchingItem.Episode.Title.Should().Be("Winter Is Coming");
                traktUserWatchingItem.Episode.Ids.Should().NotBeNull();
                traktUserWatchingItem.Episode.Ids.Trakt.Should().Be(73640U);
                traktUserWatchingItem.Episode.Ids.Tvdb.Should().Be(3254641U);
                traktUserWatchingItem.Episode.Ids.Imdb.Should().Be("tt1480055");
                traktUserWatchingItem.Episode.Ids.Tmdb.Should().Be(63056U);
                traktUserWatchingItem.Episode.Ids.TvRage.Should().Be(1065008299U);
                traktUserWatchingItem.Show.Should().NotBeNull();
                traktUserWatchingItem.Show.Title.Should().Be("Game of Thrones");
                traktUserWatchingItem.Show.Year.Should().Be(2011);
                traktUserWatchingItem.Show.Ids.Should().NotBeNull();
                traktUserWatchingItem.Show.Ids.Trakt.Should().Be(1390U);
                traktUserWatchingItem.Show.Ids.Slug.Should().Be("game-of-thrones");
                traktUserWatchingItem.Show.Ids.Tvdb.Should().Be(121361U);
                traktUserWatchingItem.Show.Ids.Imdb.Should().Be("tt0944947");
                traktUserWatchingItem.Show.Ids.Tmdb.Should().Be(1399U);
                traktUserWatchingItem.Show.Ids.TvRage.Should().Be(24493U);

                traktUserWatchingItem.Movie.Should().BeNull();
            }
        }
Esempio n. 30
0
 public async Task Test_UserWatchingItemObjectJsonReader_ReadObject_From_Json_String_Null()
 {
     var jsonReader = new UserWatchingItemObjectJsonReader();
     Func <Task <ITraktUserWatchingItem> > traktUserWatchingItem = () => jsonReader.ReadObjectAsync(default(string));
     await traktUserWatchingItem.Should().ThrowAsync <ArgumentNullException>();
 }