public void TestTraktEpisodeCheckinPostResponseDefaultConstructor() { var episodeCheckinResponse = new TraktEpisodeCheckinPostResponse(); episodeCheckinResponse.WatchedAt.Should().NotHaveValue(); episodeCheckinResponse.Sharing.Should().BeNull(); episodeCheckinResponse.Episode.Should().BeNull(); episodeCheckinResponse.Show.Should().BeNull(); }
public void Test_TraktEpisodeCheckinPostResponse_Default_Constructor() { var episodeCheckinResponse = new TraktEpisodeCheckinPostResponse(); episodeCheckinResponse.Id.Should().Be(0); episodeCheckinResponse.WatchedAt.Should().BeNull(); episodeCheckinResponse.Sharing.Should().BeNull(); episodeCheckinResponse.Episode.Should().BeNull(); episodeCheckinResponse.Show.Should().BeNull(); }
public override async Task <ITraktEpisodeCheckinPostResponse> ReadObjectAsync(JsonTextReader jsonReader, CancellationToken cancellationToken = default) { CheckJsonTextReader(jsonReader); if (await jsonReader.ReadAsync(cancellationToken) && jsonReader.TokenType == JsonToken.StartObject) { var sharingReader = new SharingObjectJsonReader(); var episodeReader = new EpisodeObjectJsonReader(); var showReader = new ShowObjectJsonReader(); ITraktEpisodeCheckinPostResponse checkinEpisodeResponse = new TraktEpisodeCheckinPostResponse(); while (await jsonReader.ReadAsync(cancellationToken) && jsonReader.TokenType == JsonToken.PropertyName) { var propertyName = jsonReader.Value.ToString(); switch (propertyName) { case JsonProperties.PROPERTY_NAME_ID: { var value = await JsonReaderHelper.ReadUnsignedLongValueAsync(jsonReader, cancellationToken); if (value.First) { checkinEpisodeResponse.Id = value.Second; } break; } case JsonProperties.PROPERTY_NAME_WATCHED_AT: { var value = await JsonReaderHelper.ReadDateTimeValueAsync(jsonReader, cancellationToken); if (value.First) { checkinEpisodeResponse.WatchedAt = value.Second; } break; } case JsonProperties.PROPERTY_NAME_SHARING: checkinEpisodeResponse.Sharing = await sharingReader.ReadObjectAsync(jsonReader, cancellationToken); break; case JsonProperties.PROPERTY_NAME_EPISODE: checkinEpisodeResponse.Episode = await episodeReader.ReadObjectAsync(jsonReader, cancellationToken); break; case JsonProperties.PROPERTY_NAME_SHOW: checkinEpisodeResponse.Show = await showReader.ReadObjectAsync(jsonReader, cancellationToken); break; default: await JsonReaderHelper.ReadAndIgnoreInvalidContentAsync(jsonReader, cancellationToken); break; } } return(checkinEpisodeResponse); } return(await Task.FromResult(default(ITraktEpisodeCheckinPostResponse))); }