Exemple #1
0
        public override async Task <ITraktSyncCommentsLastActivities> ReadObjectAsync(JsonTextReader jsonReader, CancellationToken cancellationToken = default)
        {
            if (jsonReader == null)
            {
                return(await Task.FromResult(default(ITraktSyncCommentsLastActivities)));
            }

            if (await jsonReader.ReadAsync(cancellationToken) && jsonReader.TokenType == JsonToken.StartObject)
            {
                ITraktSyncCommentsLastActivities commentsLastActivities = new TraktSyncCommentsLastActivities();

                while (await jsonReader.ReadAsync(cancellationToken) && jsonReader.TokenType == JsonToken.PropertyName)
                {
                    var propertyName = jsonReader.Value.ToString();

                    switch (propertyName)
                    {
                    case JsonProperties.SYNC_COMMENTS_LAST_ACTIVITIES_PROPERTY_NAME_LIKED_AT:
                    {
                        var value = await JsonReaderHelper.ReadDateTimeValueAsync(jsonReader, cancellationToken);

                        if (value.First)
                        {
                            commentsLastActivities.LikedAt = value.Second;
                        }

                        break;
                    }

                    default:
                        await JsonReaderHelper.ReadAndIgnoreInvalidContentAsync(jsonReader, cancellationToken);

                        break;
                    }
                }

                return(commentsLastActivities);
            }

            return(await Task.FromResult(default(ITraktSyncCommentsLastActivities)));
        }
        public void Test_TraktSyncCommentsLastActivities_Default_Constructor()
        {
            var commentsLastActivities = new TraktSyncCommentsLastActivities();

            commentsLastActivities.LikedAt.Should().BeNull();
        }