public async Task Test_TraktCommentsModule_PostCommentReply_ArgumentExceptions()
        {
            ITraktCommentReplyPost commentReplyPost = new TraktCommentReplyPost
            {
                Comment = COMMENT_TEXT
            };

            string postJson = await TestUtility.SerializeObject(commentReplyPost);

            postJson.Should().NotBeNullOrEmpty();

            TraktClient client = TestUtility.GetOAuthMockClient(POST_COMMENT_REPLY_URI, postJson, COMMENT_POST_RESPONSE_JSON);

            Func <Task <TraktResponse <ITraktCommentPostResponse> > > act = () => client.Comments.PostCommentReplyAsync(0, COMMENT_TEXT);
            await act.Should().ThrowAsync <ArgumentException>();

            act = () => client.Comments.PostCommentReplyAsync(COMMENT_ID, null);
            await act.Should().ThrowAsync <ArgumentException>();

            act = () => client.Comments.PostCommentReplyAsync(COMMENT_ID, string.Empty);
            await act.Should().ThrowAsync <ArgumentException>();

            const string comment = "one two three four";

            act = () => client.Comments.PostCommentReplyAsync(COMMENT_ID, comment);
            await act.Should().ThrowAsync <ArgumentOutOfRangeException>();
        }
        public void TestTraktCommentReplyPostDefaultConstructor()
        {
            var commentReply = new TraktCommentReplyPost();

            commentReply.Comment.Should().BeNullOrEmpty();
            commentReply.Spoiler.Should().NotHaveValue();
        }
        public override async Task <ITraktCommentReplyPost> ReadObjectAsync(JsonTextReader jsonReader, CancellationToken cancellationToken = default)
        {
            if (jsonReader == null)
            {
                return(await Task.FromResult(default(ITraktCommentReplyPost)));
            }

            if (await jsonReader.ReadAsync(cancellationToken) && jsonReader.TokenType == JsonToken.StartObject)
            {
                ITraktCommentReplyPost commentReplyPost = new TraktCommentReplyPost();

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

                    switch (propertyName)
                    {
                    case JsonProperties.COMMENT_UPDATE_POST_PROPERTY_NAME_COMMENT:
                        commentReplyPost.Comment = await jsonReader.ReadAsStringAsync(cancellationToken);

                        break;

                    case JsonProperties.COMMENT_UPDATE_POST_PROPERTY_NAME_SPOILER:
                    {
                        bool?value = await jsonReader.ReadAsBooleanAsync(cancellationToken);

                        if (value.HasValue)
                        {
                            commentReplyPost.Spoiler = value.Value;
                        }

                        break;
                    }

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

                        break;
                    }
                }

                return(commentReplyPost);
            }

            return(await Task.FromResult(default(ITraktCommentReplyPost)));
        }
        public void TestTraktCommentReplyPostWriteJson()
        {
            var comment = "this is a comment reply";
            var spoiler = true;

            var commentReply = new TraktCommentReplyPost {
                Comment = comment, Spoiler = spoiler
            };

            var strJson = JsonConvert.SerializeObject(commentReply);

            strJson.Should().NotBeNullOrEmpty();

            var commentReplyFromJson = JsonConvert.DeserializeObject <TraktCommentReplyPost>(strJson);

            commentReplyFromJson.Should().NotBeNull();
            commentReplyFromJson.Comment.Should().Be(comment);
            commentReplyFromJson.Spoiler.Should().Be(spoiler);
        }
        public async Task Test_TraktCommentsModule_PostCommentReply_With_Spoiler()
        {
            ITraktCommentReplyPost commentReplyPost = new TraktCommentReplyPost
            {
                Comment = COMMENT_TEXT,
                Spoiler = SPOILER
            };

            string postJson = await TestUtility.SerializeObject(commentReplyPost);

            postJson.Should().NotBeNullOrEmpty();

            TraktClient client = TestUtility.GetOAuthMockClient(POST_COMMENT_REPLY_URI, postJson, COMMENT_POST_RESPONSE_JSON);
            TraktResponse <ITraktCommentPostResponse> response = await client.Comments.PostCommentReplyAsync(COMMENT_ID, COMMENT_TEXT, SPOILER);

            response.Should().NotBeNull();
            response.IsSuccess.Should().BeTrue();
            response.HasValue.Should().BeTrue();
            response.Value.Should().NotBeNull();

            ITraktCommentPostResponse responseValue = response.Value;

            responseValue.Id.Should().Be(COMMENT_ID);
            responseValue.ParentId.Should().Be(0U);
            responseValue.CreatedAt.Should().Be(DateTime.Parse("2014-08-04T06:46:01.996Z").ToUniversalTime());
            responseValue.Comment.Should().Be("Oh, I wasn't really listening.");
            responseValue.Spoiler.Should().BeFalse();
            responseValue.Review.Should().BeFalse();
            responseValue.Replies.Should().Be(0);
            responseValue.Likes.Should().Be(0);
            responseValue.UserRating.Should().NotHaveValue();
            responseValue.User.Should().NotBeNull();
            responseValue.User.Username.Should().Be("sean");
            responseValue.User.IsPrivate.Should().BeFalse();
            responseValue.User.Name.Should().Be("Sean Rudford");
            responseValue.User.IsVIP.Should().BeTrue();
            responseValue.User.IsVIP_EP.Should().BeFalse();
            responseValue.Sharing.Should().NotBeNull();
            responseValue.Sharing.Facebook.Should().BeTrue();
            responseValue.Sharing.Twitter.Should().BeTrue();
            responseValue.Sharing.Tumblr.Should().BeFalse();
            responseValue.Sharing.Medium.Should().BeTrue();
        }