public void TimestampParsing()
        {
            var originalTime        = new System.DateTime(2019, 10, 15, 8, 30, 0).ToUniversalTime();
            var originalTimestamp   = originalTime.ToString("O");
            var originalTimestampId = originalTimestamp;
            var originalCommentId   = ArticleReactionTimestampId.TimestampToJQueryFriendlyString(originalTimestamp);
            var originalComment     = new ArticleReaction()
            {
                TimestampId = originalTimestampId
            };

            Assert.AreEqual(originalTime, originalComment.PublishDate);
            Assert.AreEqual(originalTimestamp, originalComment.TimestampAsString);
            Assert.AreEqual(originalCommentId, originalComment.ReactionId);
            Assert.AreEqual(originalTimestampId, originalComment.TimestampId);
            Assert.IsEmpty(originalComment.ReactingToId);

            var replyTime        = originalTime.AddMinutes(30);
            var replyTimestamp   = replyTime.ToString("O");
            var replyCommentId   = originalCommentId + "_" + ArticleReactionTimestampId.TimestampToJQueryFriendlyString(replyTimestamp);
            var replyTimestampId = $"{replyTimestamp}_{originalTimestamp}";
            var replyComment     = new ArticleReaction()
            {
                TimestampId = replyTimestampId
            };

            Assert.AreEqual(replyTime, replyComment.PublishDate);
            Assert.AreEqual(replyTimestamp, replyComment.TimestampAsString);
            Assert.AreEqual(replyCommentId, replyComment.ReactionId);
            Assert.AreEqual(replyTimestampId, replyComment.TimestampId);
            Assert.AreEqual(originalComment.ReactionId, replyComment.ReactingToId);
        }
        public void ConvertToJQueryFriendlyAndBack()
        {
            var timestampString = System.DateTime.UtcNow.ToString("O");

            var jqueryFriendlyString = ArticleReactionTimestampId.TimestampToJQueryFriendlyString(timestampString);

            // from https://stackoverflow.com/a/2837646/1001100
            Assert.IsFalse(Regex.IsMatch(jqueryFriendlyString, @"[!""#$%&'()*+,.\/:;<=>?@[\\\]^`{|}~]"));

            var backToTimestampString = ArticleReactionTimestampId.JQueryFriendlyToTimestampString(jqueryFriendlyString);

            Assert.AreEqual(timestampString, backToTimestampString);
        }
        public void TimestampIdConvertedProperly()
        {
            var rootDate  = System.DateTime.UtcNow;
            var replyDate = rootDate.AddDays(1);

            var rootId  = new ArticleReactionTimestampId(rootDate);
            var replyId = new ArticleReactionTimestampId(replyDate, rootId.ReactionId);

            // Assert ToString() returns as timestamps
            Assert.AreEqual(replyId.ToString(), ArticleReactionTimestampId.JQueryFriendlyToTimestampString(replyId.ToString()));

            // Assert ReactionId returns as JQuery-friendly
            Assert.AreEqual(replyId.ReactionId, ArticleReactionTimestampId.TimestampToJQueryFriendlyString(replyId.ReactionId));

            // Assert reactionID gets converted back to timestamps internally
            var replyIdFromPrevious = new ArticleReactionTimestampId(replyId.ReactionId);

            Assert.AreEqual(replyIdFromPrevious.ToString(), ArticleReactionTimestampId.JQueryFriendlyToTimestampString(replyIdFromPrevious.ToString()));
        }