Exemple #1
0
        public void ConvertToOriginalPost_ErrorTest()
        {
            // 公式 RT でないツイート
            var post = new PostClass { StatusId = 100L, RetweetedId = null };

            Assert.Throws<InvalidOperationException>(() => post.ConvertToOriginalPost());
        }
Exemple #2
0
        public void ConvertToOriginalPost_Test()
        {
            var retweetPost = new PostClass
            {
                StatusId = 100L,
                ScreenName = "@aaa",
                UserId = 1L,

                RetweetedId = 50L,
                RetweetedBy = "@bbb",
                RetweetedByUserId = 2L,
                RetweetedCount = 0,
            };

            var originalPost = retweetPost.ConvertToOriginalPost();

            Assert.Equal(50L, originalPost.StatusId);
            Assert.Equal("@aaa", originalPost.ScreenName);
            Assert.Equal(1L, originalPost.UserId);

            Assert.Equal(null, originalPost.RetweetedId);
            Assert.Equal("", originalPost.RetweetedBy);
            Assert.Equal(null, originalPost.RetweetedByUserId);
            Assert.Equal(1, originalPost.RetweetedCount);
        }