public async Task Test_CollectionShowObjectJsonReader_ReadObject_From_JsonReader_Incomplete_3() { var traktJsonReader = new CollectionShowObjectJsonReader(); using (var reader = new StringReader(JSON_INCOMPLETE_3)) using (var jsonReader = new JsonTextReader(reader)) { var traktCollectionShow = await traktJsonReader.ReadObjectAsync(jsonReader); traktCollectionShow.Should().NotBeNull(); traktCollectionShow.LastCollectedAt.Should().Be(DateTime.Parse("2014-07-14T01:00:00.000Z").ToUniversalTime()); traktCollectionShow.Show.Should().NotBeNull(); traktCollectionShow.Show.Title.Should().Be("Game of Thrones"); traktCollectionShow.Show.Year.Should().Be(2011); traktCollectionShow.Show.Ids.Should().NotBeNull(); traktCollectionShow.Show.Ids.Trakt.Should().Be(1390U); traktCollectionShow.Show.Ids.Slug.Should().Be("game-of-thrones"); traktCollectionShow.Show.Ids.Tvdb.Should().Be(121361U); traktCollectionShow.Show.Ids.Imdb.Should().Be("tt0944947"); traktCollectionShow.Show.Ids.Tmdb.Should().Be(1399U); traktCollectionShow.Show.Ids.TvRage.Should().Be(24493U); traktCollectionShow.CollectionSeasons.Should().BeNull(); } }
public async Task Test_CollectionShowObjectJsonReader_ReadObject_From_Stream_Incomplete_5() { var jsonReader = new CollectionShowObjectJsonReader(); using (var stream = JSON_INCOMPLETE_5.ToStream()) { var traktCollectionShow = await jsonReader.ReadObjectAsync(stream); traktCollectionShow.Should().NotBeNull(); traktCollectionShow.LastCollectedAt.Should().BeNull(); traktCollectionShow.Show.Should().NotBeNull(); traktCollectionShow.Show.Title.Should().Be("Game of Thrones"); traktCollectionShow.Show.Year.Should().Be(2011); traktCollectionShow.Show.Ids.Should().NotBeNull(); traktCollectionShow.Show.Ids.Trakt.Should().Be(1390U); traktCollectionShow.Show.Ids.Slug.Should().Be("game-of-thrones"); traktCollectionShow.Show.Ids.Tvdb.Should().Be(121361U); traktCollectionShow.Show.Ids.Imdb.Should().Be("tt0944947"); traktCollectionShow.Show.Ids.Tmdb.Should().Be(1399U); traktCollectionShow.Show.Ids.TvRage.Should().Be(24493U); traktCollectionShow.CollectionSeasons.Should().BeNull(); } }
public void Test_CollectionShowObjectJsonReader_ReadObject_From_Stream_Null() { var jsonReader = new CollectionShowObjectJsonReader(); Func <Task <ITraktCollectionShow> > traktCollectionShow = () => jsonReader.ReadObjectAsync(default(Stream)); traktCollectionShow.Should().Throw <ArgumentNullException>(); }
public async Task Test_CollectionShowObjectJsonReader_ReadObject_From_Stream_Not_Valid_3() { var jsonReader = new CollectionShowObjectJsonReader(); using (var stream = JSON_NOT_VALID_3.ToStream()) { var traktCollectionShow = await jsonReader.ReadObjectAsync(stream); traktCollectionShow.Should().NotBeNull(); traktCollectionShow.LastCollectedAt.Should().Be(DateTime.Parse("2014-07-14T01:00:00.000Z").ToUniversalTime()); traktCollectionShow.Show.Should().NotBeNull(); traktCollectionShow.Show.Title.Should().Be("Game of Thrones"); traktCollectionShow.Show.Year.Should().Be(2011); traktCollectionShow.Show.Ids.Should().NotBeNull(); traktCollectionShow.Show.Ids.Trakt.Should().Be(1390U); traktCollectionShow.Show.Ids.Slug.Should().Be("game-of-thrones"); traktCollectionShow.Show.Ids.Tvdb.Should().Be(121361U); traktCollectionShow.Show.Ids.Imdb.Should().Be("tt0944947"); traktCollectionShow.Show.Ids.Tmdb.Should().Be(1399U); traktCollectionShow.Show.Ids.TvRage.Should().Be(24493U); traktCollectionShow.CollectionSeasons.Should().BeNull(); } }
public async Task Test_CollectionShowObjectJsonReader_ReadObject_From_Json_String_Empty() { var jsonReader = new CollectionShowObjectJsonReader(); var traktCollectionShow = await jsonReader.ReadObjectAsync(string.Empty); traktCollectionShow.Should().BeNull(); }
public async Task Test_CollectionShowObjectJsonReader_ReadObject_From_Stream_Null() { var jsonReader = new CollectionShowObjectJsonReader(); var traktCollectionShow = await jsonReader.ReadObjectAsync(default(Stream)); traktCollectionShow.Should().BeNull(); }
public async Task Test_CollectionShowObjectJsonReader_ReadObject_From_JsonReader_Null() { var traktJsonReader = new CollectionShowObjectJsonReader(); var traktCollectionShow = await traktJsonReader.ReadObjectAsync(default(JsonTextReader)); traktCollectionShow.Should().BeNull(); }
public async Task Test_CollectionShowObjectJsonReader_ReadObject_From_Stream_Empty() { var jsonReader = new CollectionShowObjectJsonReader(); using (var stream = string.Empty.ToStream()) { var traktCollectionShow = await jsonReader.ReadObjectAsync(stream); traktCollectionShow.Should().BeNull(); } }
public async Task Test_CollectionShowObjectJsonReader_ReadObject_From_Json_String_Not_Valid_4() { var jsonReader = new CollectionShowObjectJsonReader(); var traktCollectionShow = await jsonReader.ReadObjectAsync(JSON_NOT_VALID_4); traktCollectionShow.Should().NotBeNull(); traktCollectionShow.LastCollectedAt.Should().BeNull(); traktCollectionShow.Show.Should().BeNull(); traktCollectionShow.CollectionSeasons.Should().BeNull(); }
public async Task Test_CollectionShowObjectJsonReader_ReadObject_From_Json_String_Incomplete_6() { var jsonReader = new CollectionShowObjectJsonReader(); var traktCollectionShow = await jsonReader.ReadObjectAsync(JSON_INCOMPLETE_6); traktCollectionShow.Should().NotBeNull(); traktCollectionShow.LastCollectedAt.Should().BeNull(); traktCollectionShow.LastUpdatedAt.Should().Be(DateTime.Parse("2014-07-14T01:00:00.000Z").ToUniversalTime()); traktCollectionShow.Show.Should().BeNull(); traktCollectionShow.CollectionSeasons.Should().BeNull(); }
public async Task Test_CollectionShowObjectJsonReader_ReadObject_From_JsonReader_Empty() { var traktJsonReader = new CollectionShowObjectJsonReader(); using (var reader = new StringReader(string.Empty)) using (var jsonReader = new JsonTextReader(reader)) { var traktCollectionShow = await traktJsonReader.ReadObjectAsync(jsonReader); traktCollectionShow.Should().BeNull(); } }
public async Task Test_CollectionShowObjectJsonReader_ReadObject_From_Stream_Not_Valid_4() { var jsonReader = new CollectionShowObjectJsonReader(); using (var stream = JSON_NOT_VALID_4.ToStream()) { var traktCollectionShow = await jsonReader.ReadObjectAsync(stream); traktCollectionShow.Should().NotBeNull(); traktCollectionShow.LastCollectedAt.Should().BeNull(); traktCollectionShow.Show.Should().BeNull(); traktCollectionShow.CollectionSeasons.Should().BeNull(); } }
public async Task Test_CollectionShowObjectJsonReader_ReadObject_From_JsonReader_Not_Valid_4() { var traktJsonReader = new CollectionShowObjectJsonReader(); using (var reader = new StringReader(JSON_NOT_VALID_4)) using (var jsonReader = new JsonTextReader(reader)) { var traktCollectionShow = await traktJsonReader.ReadObjectAsync(jsonReader); traktCollectionShow.Should().NotBeNull(); traktCollectionShow.LastCollectedAt.Should().BeNull(); traktCollectionShow.Show.Should().BeNull(); traktCollectionShow.CollectionSeasons.Should().BeNull(); } }
public async Task Test_CollectionShowObjectJsonReader_ReadObject_From_JsonReader_Incomplete_4() { var traktJsonReader = new CollectionShowObjectJsonReader(); using (var reader = new StringReader(JSON_INCOMPLETE_4)) using (var jsonReader = new JsonTextReader(reader)) { var traktCollectionShow = await traktJsonReader.ReadObjectAsync(jsonReader); traktCollectionShow.Should().NotBeNull(); traktCollectionShow.LastCollectedAt.Should().Be(DateTime.Parse("2014-07-14T01:00:00.000Z").ToUniversalTime()); traktCollectionShow.Show.Should().BeNull(); traktCollectionShow.CollectionSeasons.Should().BeNull(); } }
public async Task Test_TraktCollectionShow_From_Minimal_Json() { var jsonReader = new CollectionShowObjectJsonReader(); var collectionShow = await jsonReader.ReadObjectAsync(MINIMAL_JSON) as TraktCollectionShow; collectionShow.Should().NotBeNull(); collectionShow.LastCollectedAt.Should().Be(DateTime.Parse("2014-07-14T01:00:00.000Z").ToUniversalTime()); collectionShow.Show.Should().NotBeNull(); collectionShow.Show.Title.Should().Be("Game of Thrones"); collectionShow.Show.Year.Should().Be(2011); collectionShow.Show.Airs.Should().BeNull(); collectionShow.Show.AvailableTranslationLanguageCodes.Should().BeNull(); collectionShow.Show.Ids.Should().NotBeNull(); collectionShow.Show.Ids.Trakt.Should().Be(1390U); collectionShow.Show.Ids.Slug.Should().Be("game-of-thrones"); collectionShow.Show.Ids.Tvdb.Should().Be(121361U); collectionShow.Show.Ids.Imdb.Should().Be("tt0944947"); collectionShow.Show.Ids.Tmdb.Should().Be(1399U); collectionShow.Show.Ids.TvRage.Should().Be(24493U); collectionShow.Show.Genres.Should().BeNull(); collectionShow.Show.Seasons.Should().BeNull(); collectionShow.Show.Overview.Should().BeNullOrEmpty(); collectionShow.Show.FirstAired.Should().NotHaveValue(); collectionShow.Show.Runtime.Should().NotHaveValue(); collectionShow.Show.Certification.Should().BeNullOrEmpty(); collectionShow.Show.Network.Should().BeNullOrEmpty(); collectionShow.Show.CountryCode.Should().BeNullOrEmpty(); collectionShow.Show.UpdatedAt.Should().NotHaveValue(); collectionShow.Show.Trailer.Should().BeNullOrEmpty(); collectionShow.Show.Homepage.Should().BeNullOrEmpty(); collectionShow.Show.Status.Should().BeNull(); collectionShow.Show.Rating.Should().NotHaveValue(); collectionShow.Show.Votes.Should().NotHaveValue(); collectionShow.Show.LanguageCode.Should().BeNullOrEmpty(); collectionShow.Show.AiredEpisodes.Should().NotHaveValue(); collectionShow.Title.Should().Be("Game of Thrones"); collectionShow.Year.Should().Be(2011); collectionShow.Airs.Should().BeNull(); collectionShow.AvailableTranslationLanguageCodes.Should().BeNull(); collectionShow.Ids.Should().NotBeNull(); collectionShow.Ids.Trakt.Should().Be(1390U); collectionShow.Ids.Slug.Should().Be("game-of-thrones"); collectionShow.Ids.Tvdb.Should().Be(121361U); collectionShow.Ids.Imdb.Should().Be("tt0944947"); collectionShow.Ids.Tmdb.Should().Be(1399U); collectionShow.Ids.TvRage.Should().Be(24493U); collectionShow.Genres.Should().BeNull(); collectionShow.Seasons.Should().BeNull(); collectionShow.Overview.Should().BeNullOrEmpty(); collectionShow.FirstAired.Should().NotHaveValue(); collectionShow.Runtime.Should().NotHaveValue(); collectionShow.Certification.Should().BeNullOrEmpty(); collectionShow.Network.Should().BeNullOrEmpty(); collectionShow.CountryCode.Should().BeNullOrEmpty(); collectionShow.UpdatedAt.Should().NotHaveValue(); collectionShow.Trailer.Should().BeNullOrEmpty(); collectionShow.Homepage.Should().BeNullOrEmpty(); collectionShow.Status.Should().BeNull(); collectionShow.Rating.Should().NotHaveValue(); collectionShow.Votes.Should().NotHaveValue(); collectionShow.LanguageCode.Should().BeNullOrEmpty(); collectionShow.AiredEpisodes.Should().NotHaveValue(); collectionShow.CollectionSeasons.Should().NotBeNull().And.HaveCount(2); var seasons = collectionShow.CollectionSeasons.ToArray(); // Season 1 seasons[0].Should().NotBeNull(); seasons[0].Number.Should().Be(1); seasons[0].Episodes.Should().NotBeNull(); seasons[0].Episodes.Should().HaveCount(2); // Episodes of Season 1 var episodesSeason1 = seasons[0].Episodes.ToArray(); episodesSeason1[0].Should().NotBeNull(); episodesSeason1[0].Number.Should().Be(1); episodesSeason1[0].CollectedAt.Should().Be(DateTime.Parse("2014-09-01T09:10:11.000Z").ToUniversalTime()); episodesSeason1[0].Metadata.Should().NotBeNull(); episodesSeason1[0].Metadata.MediaType.Should().Be(TraktMediaType.Digital); episodesSeason1[0].Metadata.MediaResolution.Should().Be(TraktMediaResolution.HD_720p); episodesSeason1[0].Metadata.Audio.Should().Be(TraktMediaAudio.AAC); episodesSeason1[0].Metadata.AudioChannels.Should().Be(TraktMediaAudioChannel.Channels_5_1); episodesSeason1[0].Metadata.ThreeDimensional.Should().BeTrue(); episodesSeason1[1].Should().NotBeNull(); episodesSeason1[1].Number.Should().Be(2); episodesSeason1[1].CollectedAt.Should().Be(DateTime.Parse("2014-09-01T09:10:11.000Z").ToUniversalTime()); episodesSeason1[1].Metadata.Should().NotBeNull(); episodesSeason1[1].Metadata.MediaType.Should().Be(TraktMediaType.Digital); episodesSeason1[1].Metadata.MediaResolution.Should().Be(TraktMediaResolution.HD_720p); episodesSeason1[1].Metadata.Audio.Should().Be(TraktMediaAudio.AAC); episodesSeason1[1].Metadata.AudioChannels.Should().Be(TraktMediaAudioChannel.Channels_5_1); episodesSeason1[1].Metadata.ThreeDimensional.Should().BeTrue(); // Season 2 seasons[1].Should().NotBeNull(); seasons[1].Number.Should().Be(2); seasons[1].Episodes.Should().NotBeNull(); seasons[1].Episodes.Should().HaveCount(2); // Episodes of Season 2 var episodesSeason2 = seasons[1].Episodes.ToArray(); episodesSeason2[0].Should().NotBeNull(); episodesSeason2[0].Number.Should().Be(1); episodesSeason2[0].CollectedAt.Should().Be(DateTime.Parse("2014-09-01T09:10:11.000Z").ToUniversalTime()); episodesSeason1[0].Metadata.Should().NotBeNull(); episodesSeason1[0].Metadata.MediaType.Should().Be(TraktMediaType.Digital); episodesSeason1[0].Metadata.MediaResolution.Should().Be(TraktMediaResolution.HD_720p); episodesSeason1[0].Metadata.Audio.Should().Be(TraktMediaAudio.AAC); episodesSeason1[0].Metadata.AudioChannels.Should().Be(TraktMediaAudioChannel.Channels_5_1); episodesSeason1[0].Metadata.ThreeDimensional.Should().BeTrue(); episodesSeason2[1].Should().NotBeNull(); episodesSeason2[1].Number.Should().Be(2); episodesSeason2[1].CollectedAt.Should().Be(DateTime.Parse("2014-09-01T09:10:11.000Z").ToUniversalTime()); episodesSeason1[1].Metadata.Should().NotBeNull(); episodesSeason1[1].Metadata.MediaType.Should().Be(TraktMediaType.Digital); episodesSeason1[1].Metadata.MediaResolution.Should().Be(TraktMediaResolution.HD_720p); episodesSeason1[1].Metadata.Audio.Should().Be(TraktMediaAudio.AAC); episodesSeason1[1].Metadata.AudioChannels.Should().Be(TraktMediaAudioChannel.Channels_5_1); episodesSeason1[1].Metadata.ThreeDimensional.Should().BeTrue(); }
public async Task Test_CollectionShowObjectJsonReader_ReadObject_From_Stream_Not_Valid_2() { var jsonReader = new CollectionShowObjectJsonReader(); using (var stream = JSON_NOT_VALID_2.ToStream()) { var traktCollectionShow = await jsonReader.ReadObjectAsync(stream); traktCollectionShow.Should().NotBeNull(); traktCollectionShow.LastCollectedAt.Should().Be(DateTime.Parse("2014-07-14T01:00:00.000Z").ToUniversalTime()); traktCollectionShow.Show.Should().BeNull(); traktCollectionShow.CollectionSeasons.Should().NotBeNull().And.HaveCount(2); var seasons = traktCollectionShow.CollectionSeasons.ToArray(); // Season 1 seasons[0].Should().NotBeNull(); seasons[0].Number.Should().Be(1); seasons[0].Episodes.Should().NotBeNull(); seasons[0].Episodes.Should().HaveCount(2); // Episodes of Season 1 var episodesSeason1 = seasons[0].Episodes.ToArray(); episodesSeason1[0].Should().NotBeNull(); episodesSeason1[0].Number.Should().Be(1); episodesSeason1[0].CollectedAt.Should().Be(DateTime.Parse("2014-09-01T09:10:11.000Z").ToUniversalTime()); episodesSeason1[0].Metadata.Should().NotBeNull(); episodesSeason1[0].Metadata.MediaType.Should().Be(TraktMediaType.Digital); episodesSeason1[0].Metadata.MediaResolution.Should().Be(TraktMediaResolution.HD_720p); episodesSeason1[0].Metadata.Audio.Should().Be(TraktMediaAudio.AAC); episodesSeason1[0].Metadata.AudioChannels.Should().Be(TraktMediaAudioChannel.Channels_5_1); episodesSeason1[0].Metadata.ThreeDimensional.Should().BeFalse(); episodesSeason1[1].Should().NotBeNull(); episodesSeason1[1].Number.Should().Be(2); episodesSeason1[1].CollectedAt.Should().Be(DateTime.Parse("2014-09-01T09:10:11.000Z").ToUniversalTime()); episodesSeason1[1].Metadata.Should().NotBeNull(); episodesSeason1[1].Metadata.MediaType.Should().Be(TraktMediaType.Digital); episodesSeason1[1].Metadata.MediaResolution.Should().Be(TraktMediaResolution.HD_720p); episodesSeason1[1].Metadata.Audio.Should().Be(TraktMediaAudio.AAC); episodesSeason1[1].Metadata.AudioChannels.Should().Be(TraktMediaAudioChannel.Channels_5_1); episodesSeason1[1].Metadata.ThreeDimensional.Should().BeFalse(); // Season 2 seasons[1].Should().NotBeNull(); seasons[1].Number.Should().Be(2); seasons[1].Episodes.Should().NotBeNull(); seasons[1].Episodes.Should().HaveCount(2); // Episodes of Season 2 var episodesSeason2 = seasons[1].Episodes.ToArray(); episodesSeason2[0].Should().NotBeNull(); episodesSeason2[0].Number.Should().Be(1); episodesSeason2[0].CollectedAt.Should().Be(DateTime.Parse("2014-09-01T09:10:11.000Z").ToUniversalTime()); episodesSeason1[0].Metadata.Should().NotBeNull(); episodesSeason1[0].Metadata.MediaType.Should().Be(TraktMediaType.Digital); episodesSeason1[0].Metadata.MediaResolution.Should().Be(TraktMediaResolution.HD_720p); episodesSeason1[0].Metadata.Audio.Should().Be(TraktMediaAudio.AAC); episodesSeason1[0].Metadata.AudioChannels.Should().Be(TraktMediaAudioChannel.Channels_5_1); episodesSeason1[0].Metadata.ThreeDimensional.Should().BeFalse(); episodesSeason2[1].Should().NotBeNull(); episodesSeason2[1].Number.Should().Be(2); episodesSeason2[1].CollectedAt.Should().Be(DateTime.Parse("2014-09-01T09:10:11.000Z").ToUniversalTime()); episodesSeason1[1].Metadata.Should().NotBeNull(); episodesSeason1[1].Metadata.MediaType.Should().Be(TraktMediaType.Digital); episodesSeason1[1].Metadata.MediaResolution.Should().Be(TraktMediaResolution.HD_720p); episodesSeason1[1].Metadata.Audio.Should().Be(TraktMediaAudio.AAC); episodesSeason1[1].Metadata.AudioChannels.Should().Be(TraktMediaAudioChannel.Channels_5_1); episodesSeason1[1].Metadata.ThreeDimensional.Should().BeFalse(); } }
public async Task Test_CollectionShowObjectJsonReader_ReadObject_From_Stream_Not_Valid_1() { var jsonReader = new CollectionShowObjectJsonReader(); using (var stream = JSON_NOT_VALID_1.ToStream()) { var traktCollectionShow = await jsonReader.ReadObjectAsync(stream); traktCollectionShow.Should().NotBeNull(); traktCollectionShow.LastCollectedAt.Should().BeNull(); traktCollectionShow.Show.Should().NotBeNull(); traktCollectionShow.Show.Title.Should().Be("Game of Thrones"); traktCollectionShow.Show.Year.Should().Be(2011); traktCollectionShow.Show.Ids.Should().NotBeNull(); traktCollectionShow.Show.Ids.Trakt.Should().Be(1390U); traktCollectionShow.Show.Ids.Slug.Should().Be("game-of-thrones"); traktCollectionShow.Show.Ids.Tvdb.Should().Be(121361U); traktCollectionShow.Show.Ids.Imdb.Should().Be("tt0944947"); traktCollectionShow.Show.Ids.Tmdb.Should().Be(1399U); traktCollectionShow.Show.Ids.TvRage.Should().Be(24493U); traktCollectionShow.CollectionSeasons.Should().NotBeNull().And.HaveCount(2); var seasons = traktCollectionShow.CollectionSeasons.ToArray(); // Season 1 seasons[0].Should().NotBeNull(); seasons[0].Number.Should().Be(1); seasons[0].Episodes.Should().NotBeNull(); seasons[0].Episodes.Should().HaveCount(2); // Episodes of Season 1 var episodesSeason1 = seasons[0].Episodes.ToArray(); episodesSeason1[0].Should().NotBeNull(); episodesSeason1[0].Number.Should().Be(1); episodesSeason1[0].CollectedAt.Should().Be(DateTime.Parse("2014-09-01T09:10:11.000Z").ToUniversalTime()); episodesSeason1[0].Metadata.Should().NotBeNull(); episodesSeason1[0].Metadata.MediaType.Should().Be(TraktMediaType.Digital); episodesSeason1[0].Metadata.MediaResolution.Should().Be(TraktMediaResolution.HD_720p); episodesSeason1[0].Metadata.Audio.Should().Be(TraktMediaAudio.AAC); episodesSeason1[0].Metadata.AudioChannels.Should().Be(TraktMediaAudioChannel.Channels_5_1); episodesSeason1[0].Metadata.ThreeDimensional.Should().BeFalse(); episodesSeason1[1].Should().NotBeNull(); episodesSeason1[1].Number.Should().Be(2); episodesSeason1[1].CollectedAt.Should().Be(DateTime.Parse("2014-09-01T09:10:11.000Z").ToUniversalTime()); episodesSeason1[1].Metadata.Should().NotBeNull(); episodesSeason1[1].Metadata.MediaType.Should().Be(TraktMediaType.Digital); episodesSeason1[1].Metadata.MediaResolution.Should().Be(TraktMediaResolution.HD_720p); episodesSeason1[1].Metadata.Audio.Should().Be(TraktMediaAudio.AAC); episodesSeason1[1].Metadata.AudioChannels.Should().Be(TraktMediaAudioChannel.Channels_5_1); episodesSeason1[1].Metadata.ThreeDimensional.Should().BeFalse(); // Season 2 seasons[1].Should().NotBeNull(); seasons[1].Number.Should().Be(2); seasons[1].Episodes.Should().NotBeNull(); seasons[1].Episodes.Should().HaveCount(2); // Episodes of Season 2 var episodesSeason2 = seasons[1].Episodes.ToArray(); episodesSeason2[0].Should().NotBeNull(); episodesSeason2[0].Number.Should().Be(1); episodesSeason2[0].CollectedAt.Should().Be(DateTime.Parse("2014-09-01T09:10:11.000Z").ToUniversalTime()); episodesSeason1[0].Metadata.Should().NotBeNull(); episodesSeason1[0].Metadata.MediaType.Should().Be(TraktMediaType.Digital); episodesSeason1[0].Metadata.MediaResolution.Should().Be(TraktMediaResolution.HD_720p); episodesSeason1[0].Metadata.Audio.Should().Be(TraktMediaAudio.AAC); episodesSeason1[0].Metadata.AudioChannels.Should().Be(TraktMediaAudioChannel.Channels_5_1); episodesSeason1[0].Metadata.ThreeDimensional.Should().BeFalse(); episodesSeason2[1].Should().NotBeNull(); episodesSeason2[1].Number.Should().Be(2); episodesSeason2[1].CollectedAt.Should().Be(DateTime.Parse("2014-09-01T09:10:11.000Z").ToUniversalTime()); episodesSeason1[1].Metadata.Should().NotBeNull(); episodesSeason1[1].Metadata.MediaType.Should().Be(TraktMediaType.Digital); episodesSeason1[1].Metadata.MediaResolution.Should().Be(TraktMediaResolution.HD_720p); episodesSeason1[1].Metadata.Audio.Should().Be(TraktMediaAudio.AAC); episodesSeason1[1].Metadata.AudioChannels.Should().Be(TraktMediaAudioChannel.Channels_5_1); episodesSeason1[1].Metadata.ThreeDimensional.Should().BeFalse(); } }
public async Task Test_CollectionShowObjectJsonReader_ReadObject_From_Json_String_Null() { var jsonReader = new CollectionShowObjectJsonReader(); Func <Task <ITraktCollectionShow> > traktCollectionShow = () => jsonReader.ReadObjectAsync(default(string)); await traktCollectionShow.Should().ThrowAsync <ArgumentNullException>(); }
public async Task Test_TraktCollectionShow_From_Full_Json() { var jsonReader = new CollectionShowObjectJsonReader(); var collectionShow = await jsonReader.ReadObjectAsync(FULL_JSON) as TraktCollectionShow; collectionShow.Should().NotBeNull(); collectionShow.LastCollectedAt.Should().Be(DateTime.Parse("2014-07-14T01:00:00.000Z").ToUniversalTime()); collectionShow.Show.Should().NotBeNull(); collectionShow.Show.Title.Should().Be("Game of Thrones"); collectionShow.Show.Year.Should().Be(2011); collectionShow.Show.Airs.Should().NotBeNull(); collectionShow.Show.Airs.Day.Should().Be("Sunday"); collectionShow.Show.Airs.Time.Should().Be("21:00"); collectionShow.Show.Airs.TimeZoneId.Should().Be("America/New_York"); collectionShow.Show.AvailableTranslationLanguageCodes.Should().NotBeNull().And.HaveCount(4).And.Contain("en", "fr", "it", "de"); collectionShow.Show.Ids.Should().NotBeNull(); collectionShow.Show.Ids.Trakt.Should().Be(1390U); collectionShow.Show.Ids.Slug.Should().Be("game-of-thrones"); collectionShow.Show.Ids.Tvdb.Should().Be(121361U); collectionShow.Show.Ids.Imdb.Should().Be("tt0944947"); collectionShow.Show.Ids.Tmdb.Should().Be(1399U); collectionShow.Show.Ids.TvRage.Should().Be(24493U); collectionShow.Show.Genres.Should().NotBeNull().And.HaveCount(5).And.Contain("drama", "fantasy", "science-fiction", "action", "adventure"); collectionShow.Show.Seasons.Should().BeNull(); collectionShow.Show.Overview.Should().Be("Seven noble families fight for control of the mythical land of Westeros. Friction between the houses leads to full-scale war. All while a very ancient evil awakens in the farthest north. Amidst the war, a neglected military order of misfits, the Night's Watch, is all that stands between the realms of men and the icy horrors beyond."); collectionShow.Show.FirstAired.Should().Be(DateTime.Parse("2011-04-17T07:00:00Z").ToUniversalTime()); collectionShow.Show.Runtime.Should().Be(60); collectionShow.Show.Certification.Should().Be("TV-MA"); collectionShow.Show.Network.Should().Be("HBO"); collectionShow.Show.CountryCode.Should().Be("us"); collectionShow.Show.UpdatedAt.Should().Be(DateTime.Parse("2016-04-06T10:39:11Z").ToUniversalTime()); collectionShow.Show.Trailer.Should().Be("http://youtube.com/watch?v=F9Bo89m2f6g"); collectionShow.Show.Homepage.Should().Be("http://www.hbo.com/game-of-thrones"); collectionShow.Show.Status.Should().Be(TraktShowStatus.ReturningSeries); collectionShow.Show.Rating.Should().Be(9.38327f); collectionShow.Show.Votes.Should().Be(44773); collectionShow.Show.LanguageCode.Should().Be("en"); collectionShow.Show.AiredEpisodes.Should().Be(50); collectionShow.Title.Should().Be("Game of Thrones"); collectionShow.Year.Should().Be(2011); collectionShow.Airs.Should().NotBeNull(); collectionShow.Airs.Day.Should().Be("Sunday"); collectionShow.Airs.Time.Should().Be("21:00"); collectionShow.Airs.TimeZoneId.Should().Be("America/New_York"); collectionShow.AvailableTranslationLanguageCodes.Should().NotBeNull().And.HaveCount(4).And.Contain("en", "fr", "it", "de"); collectionShow.Ids.Should().NotBeNull(); collectionShow.Ids.Trakt.Should().Be(1390U); collectionShow.Ids.Slug.Should().Be("game-of-thrones"); collectionShow.Ids.Tvdb.Should().Be(121361U); collectionShow.Ids.Imdb.Should().Be("tt0944947"); collectionShow.Ids.Tmdb.Should().Be(1399U); collectionShow.Ids.TvRage.Should().Be(24493U); collectionShow.Genres.Should().NotBeNull().And.HaveCount(5).And.Contain("drama", "fantasy", "science-fiction", "action", "adventure"); collectionShow.Seasons.Should().BeNull(); collectionShow.Overview.Should().Be("Seven noble families fight for control of the mythical land of Westeros. Friction between the houses leads to full-scale war. All while a very ancient evil awakens in the farthest north. Amidst the war, a neglected military order of misfits, the Night's Watch, is all that stands between the realms of men and the icy horrors beyond."); collectionShow.FirstAired.Should().Be(DateTime.Parse("2011-04-17T07:00:00Z").ToUniversalTime()); collectionShow.Runtime.Should().Be(60); collectionShow.Certification.Should().Be("TV-MA"); collectionShow.Network.Should().Be("HBO"); collectionShow.CountryCode.Should().Be("us"); collectionShow.UpdatedAt.Should().Be(DateTime.Parse("2016-04-06T10:39:11Z").ToUniversalTime()); collectionShow.Trailer.Should().Be("http://youtube.com/watch?v=F9Bo89m2f6g"); collectionShow.Homepage.Should().Be("http://www.hbo.com/game-of-thrones"); collectionShow.Status.Should().Be(TraktShowStatus.ReturningSeries); collectionShow.Rating.Should().Be(9.38327f); collectionShow.Votes.Should().Be(44773); collectionShow.LanguageCode.Should().Be("en"); collectionShow.AiredEpisodes.Should().Be(50); collectionShow.CollectionSeasons.Should().NotBeNull().And.HaveCount(2); var seasons = collectionShow.CollectionSeasons.ToArray(); // Season 1 seasons[0].Should().NotBeNull(); seasons[0].Number.Should().Be(1); seasons[0].Episodes.Should().NotBeNull(); seasons[0].Episodes.Should().HaveCount(2); // Episodes of Season 1 var episodesSeason1 = seasons[0].Episodes.ToArray(); episodesSeason1[0].Should().NotBeNull(); episodesSeason1[0].Number.Should().Be(1); episodesSeason1[0].CollectedAt.Should().Be(DateTime.Parse("2014-09-01T09:10:11.000Z").ToUniversalTime()); episodesSeason1[0].Metadata.Should().NotBeNull(); episodesSeason1[0].Metadata.MediaType.Should().Be(TraktMediaType.Digital); episodesSeason1[0].Metadata.MediaResolution.Should().Be(TraktMediaResolution.HD_720p); episodesSeason1[0].Metadata.Audio.Should().Be(TraktMediaAudio.AAC); episodesSeason1[0].Metadata.AudioChannels.Should().Be(TraktMediaAudioChannel.Channels_5_1); episodesSeason1[0].Metadata.ThreeDimensional.Should().BeTrue(); episodesSeason1[1].Should().NotBeNull(); episodesSeason1[1].Number.Should().Be(2); episodesSeason1[1].CollectedAt.Should().Be(DateTime.Parse("2014-09-01T09:10:11.000Z").ToUniversalTime()); episodesSeason1[1].Metadata.Should().NotBeNull(); episodesSeason1[1].Metadata.MediaType.Should().Be(TraktMediaType.Digital); episodesSeason1[1].Metadata.MediaResolution.Should().Be(TraktMediaResolution.HD_720p); episodesSeason1[1].Metadata.Audio.Should().Be(TraktMediaAudio.AAC); episodesSeason1[1].Metadata.AudioChannels.Should().Be(TraktMediaAudioChannel.Channels_5_1); episodesSeason1[1].Metadata.ThreeDimensional.Should().BeTrue(); // Season 2 seasons[1].Should().NotBeNull(); seasons[1].Number.Should().Be(2); seasons[1].Episodes.Should().NotBeNull(); seasons[1].Episodes.Should().HaveCount(2); // Episodes of Season 2 var episodesSeason2 = seasons[1].Episodes.ToArray(); episodesSeason2[0].Should().NotBeNull(); episodesSeason2[0].Number.Should().Be(1); episodesSeason2[0].CollectedAt.Should().Be(DateTime.Parse("2014-09-01T09:10:11.000Z").ToUniversalTime()); episodesSeason1[0].Metadata.Should().NotBeNull(); episodesSeason1[0].Metadata.MediaType.Should().Be(TraktMediaType.Digital); episodesSeason1[0].Metadata.MediaResolution.Should().Be(TraktMediaResolution.HD_720p); episodesSeason1[0].Metadata.Audio.Should().Be(TraktMediaAudio.AAC); episodesSeason1[0].Metadata.AudioChannels.Should().Be(TraktMediaAudioChannel.Channels_5_1); episodesSeason1[0].Metadata.ThreeDimensional.Should().BeTrue(); episodesSeason2[1].Should().NotBeNull(); episodesSeason2[1].Number.Should().Be(2); episodesSeason2[1].CollectedAt.Should().Be(DateTime.Parse("2014-09-01T09:10:11.000Z").ToUniversalTime()); episodesSeason1[1].Metadata.Should().NotBeNull(); episodesSeason1[1].Metadata.MediaType.Should().Be(TraktMediaType.Digital); episodesSeason1[1].Metadata.MediaResolution.Should().Be(TraktMediaResolution.HD_720p); episodesSeason1[1].Metadata.Audio.Should().Be(TraktMediaAudio.AAC); episodesSeason1[1].Metadata.AudioChannels.Should().Be(TraktMediaAudioChannel.Channels_5_1); episodesSeason1[1].Metadata.ThreeDimensional.Should().BeTrue(); }
public async Task Test_CollectionShowObjectJsonReader_ReadObject_From_JsonReader_Incomplete_6() { var traktJsonReader = new CollectionShowObjectJsonReader(); using (var reader = new StringReader(JSON_INCOMPLETE_6)) using (var jsonReader = new JsonTextReader(reader)) { var traktCollectionShow = await traktJsonReader.ReadObjectAsync(jsonReader); traktCollectionShow.Should().NotBeNull(); traktCollectionShow.LastCollectedAt.Should().BeNull(); traktCollectionShow.Show.Should().BeNull(); traktCollectionShow.CollectionSeasons.Should().NotBeNull().And.HaveCount(2); var seasons = traktCollectionShow.CollectionSeasons.ToArray(); // Season 1 seasons[0].Should().NotBeNull(); seasons[0].Number.Should().Be(1); seasons[0].Episodes.Should().NotBeNull(); seasons[0].Episodes.Should().HaveCount(2); // Episodes of Season 1 var episodesSeason1 = seasons[0].Episodes.ToArray(); episodesSeason1[0].Should().NotBeNull(); episodesSeason1[0].Number.Should().Be(1); episodesSeason1[0].CollectedAt.Should().Be(DateTime.Parse("2014-09-01T09:10:11.000Z").ToUniversalTime()); episodesSeason1[0].Metadata.Should().NotBeNull(); episodesSeason1[0].Metadata.MediaType.Should().Be(TraktMediaType.Digital); episodesSeason1[0].Metadata.MediaResolution.Should().Be(TraktMediaResolution.HD_720p); episodesSeason1[0].Metadata.Audio.Should().Be(TraktMediaAudio.AAC); episodesSeason1[0].Metadata.AudioChannels.Should().Be(TraktMediaAudioChannel.Channels_5_1); episodesSeason1[0].Metadata.ThreeDimensional.Should().BeFalse(); episodesSeason1[1].Should().NotBeNull(); episodesSeason1[1].Number.Should().Be(2); episodesSeason1[1].CollectedAt.Should().Be(DateTime.Parse("2014-09-01T09:10:11.000Z").ToUniversalTime()); episodesSeason1[1].Metadata.Should().NotBeNull(); episodesSeason1[1].Metadata.MediaType.Should().Be(TraktMediaType.Digital); episodesSeason1[1].Metadata.MediaResolution.Should().Be(TraktMediaResolution.HD_720p); episodesSeason1[1].Metadata.Audio.Should().Be(TraktMediaAudio.AAC); episodesSeason1[1].Metadata.AudioChannels.Should().Be(TraktMediaAudioChannel.Channels_5_1); episodesSeason1[1].Metadata.ThreeDimensional.Should().BeFalse(); // Season 2 seasons[1].Should().NotBeNull(); seasons[1].Number.Should().Be(2); seasons[1].Episodes.Should().NotBeNull(); seasons[1].Episodes.Should().HaveCount(2); // Episodes of Season 2 var episodesSeason2 = seasons[1].Episodes.ToArray(); episodesSeason2[0].Should().NotBeNull(); episodesSeason2[0].Number.Should().Be(1); episodesSeason2[0].CollectedAt.Should().Be(DateTime.Parse("2014-09-01T09:10:11.000Z").ToUniversalTime()); episodesSeason1[0].Metadata.Should().NotBeNull(); episodesSeason1[0].Metadata.MediaType.Should().Be(TraktMediaType.Digital); episodesSeason1[0].Metadata.MediaResolution.Should().Be(TraktMediaResolution.HD_720p); episodesSeason1[0].Metadata.Audio.Should().Be(TraktMediaAudio.AAC); episodesSeason1[0].Metadata.AudioChannels.Should().Be(TraktMediaAudioChannel.Channels_5_1); episodesSeason1[0].Metadata.ThreeDimensional.Should().BeFalse(); episodesSeason2[1].Should().NotBeNull(); episodesSeason2[1].Number.Should().Be(2); episodesSeason2[1].CollectedAt.Should().Be(DateTime.Parse("2014-09-01T09:10:11.000Z").ToUniversalTime()); episodesSeason1[1].Metadata.Should().NotBeNull(); episodesSeason1[1].Metadata.MediaType.Should().Be(TraktMediaType.Digital); episodesSeason1[1].Metadata.MediaResolution.Should().Be(TraktMediaResolution.HD_720p); episodesSeason1[1].Metadata.Audio.Should().Be(TraktMediaAudio.AAC); episodesSeason1[1].Metadata.AudioChannels.Should().Be(TraktMediaAudioChannel.Channels_5_1); episodesSeason1[1].Metadata.ThreeDimensional.Should().BeFalse(); } }