public void Test_TraktWatchedShow_Default_Constructor() { var watchedShow = new TraktWatchedShow(); watchedShow.Plays.Should().NotHaveValue(); watchedShow.LastWatchedAt.Should().NotHaveValue(); watchedShow.LastUpdatedAt.Should().NotHaveValue(); watchedShow.ResetAt.Should().NotHaveValue(); watchedShow.Show.Should().BeNull(); watchedShow.WatchedSeasons.Should().BeNull(); watchedShow.Title.Should().BeNullOrEmpty(); watchedShow.Year.Should().NotHaveValue(); watchedShow.Airs.Should().BeNull(); watchedShow.AvailableTranslationLanguageCodes.Should().BeNull(); watchedShow.Ids.Should().BeNull(); watchedShow.Genres.Should().BeNull(); watchedShow.Seasons.Should().BeNull(); watchedShow.Overview.Should().BeNullOrEmpty(); watchedShow.FirstAired.Should().NotHaveValue(); watchedShow.Runtime.Should().NotHaveValue(); watchedShow.Certification.Should().BeNullOrEmpty(); watchedShow.Network.Should().BeNullOrEmpty(); watchedShow.CountryCode.Should().BeNullOrEmpty(); watchedShow.UpdatedAt.Should().NotHaveValue(); watchedShow.Trailer.Should().BeNullOrEmpty(); watchedShow.Homepage.Should().BeNullOrEmpty(); watchedShow.Status.Should().BeNull(); watchedShow.Rating.Should().NotHaveValue(); watchedShow.Votes.Should().NotHaveValue(); watchedShow.LanguageCode.Should().BeNullOrEmpty(); watchedShow.AiredEpisodes.Should().NotHaveValue(); }
public override async Task <ITraktWatchedShow> ReadObjectAsync(JsonTextReader jsonReader, CancellationToken cancellationToken = default) { if (jsonReader == null) { return(await Task.FromResult(default(ITraktWatchedShow))); } if (await jsonReader.ReadAsync(cancellationToken) && jsonReader.TokenType == JsonToken.StartObject) { var showObjectReader = new ShowObjectJsonReader(); var showSeasonsArrayReader = new WatchedShowSeasonArrayJsonReader(); ITraktWatchedShow traktWatchedShow = new TraktWatchedShow(); while (await jsonReader.ReadAsync(cancellationToken) && jsonReader.TokenType == JsonToken.PropertyName) { var propertyName = jsonReader.Value.ToString(); switch (propertyName) { case JsonProperties.WATCHED_SHOW_PROPERTY_NAME_PLAYS: traktWatchedShow.Plays = await jsonReader.ReadAsInt32Async(cancellationToken); break; case JsonProperties.WATCHED_SHOW_PROPERTY_NAME_LAST_WATCHED_AT: { var value = await JsonReaderHelper.ReadDateTimeValueAsync(jsonReader, cancellationToken); if (value.First) { traktWatchedShow.LastWatchedAt = value.Second; } break; } case JsonProperties.WATCHED_SHOW_PROPERTY_NAME_SHOW: traktWatchedShow.Show = await showObjectReader.ReadObjectAsync(jsonReader, cancellationToken); break; case JsonProperties.WATCHED_SHOW_PROPERTY_NAME_SEASONS: traktWatchedShow.WatchedSeasons = await showSeasonsArrayReader.ReadArrayAsync(jsonReader, cancellationToken); break; default: await JsonReaderHelper.ReadAndIgnoreInvalidContentAsync(jsonReader, cancellationToken); break; } } return(traktWatchedShow); } return(await Task.FromResult(default(ITraktWatchedShow))); }
public void TestTraktWatchedShowDefaultConstructor() { var showItem = new TraktWatchedShow(); showItem.Plays.Should().NotHaveValue(); showItem.LastWatchedAt.Should().NotHaveValue(); showItem.Show.Should().BeNull(); showItem.Seasons.Should().BeNull(); }