Example #1
0
        public void GetComments_WithLikes()
        {
            const string url  = "https://api.vk.com/method/video.getComments?video_id=166481021&owner_id=1&need_likes=1&count=2&offset=3&sort=asc&v=5.9&access_token=token";
            const string json =
                @"{
                    'response': {
                      'count': 2146,
                      'items': [
                        {
                          'id': 14715,
                          'from_id': 24758120,
                          'date': 1384867361,
                          'text': 'паша здаров!',
                          'likes': {
                            'count': 5,
                            'user_likes': 0,
                            'can_like': 1
                          }
                        },
                        {
                          'id': 14716,
                          'from_id': 94278436,
                          'date': 1384867372,
                          'text': 'Я опять на странице Дурова, опять передаю привет Маме, Бабушке и своим друзьям! Дела у меня очень отлично!',
                          'likes': {
                            'count': 77,
                            'user_likes': 0,
                            'can_like': 1
                          }
                        }
                      ]
                    }
                  }";

            VideoCategory cat = GetMockedVideoCategory(url, json);

            ReadOnlyCollection <Comment> comments = cat.GetComments(166481021, 1, true, 2, 3, CommentsSort.Asc);

            comments.Count.ShouldEqual(2);

            comments[0].Id.ShouldEqual(14715);
            comments[0].FromId.ShouldEqual(24758120);
            comments[0].Date.ShouldEqual(new DateTime(2013, 11, 19, 17, 22, 41));
            comments[0].Text.ShouldEqual("паша здаров!");
            comments[0].Likes.Count.ShouldEqual(5);
            comments[0].Likes.UserLikes.ShouldEqual(false);
            comments[0].Likes.CanLike.ShouldEqual(true);

            comments[1].Id.ShouldEqual(14716);
            comments[1].FromId.ShouldEqual(94278436);
            comments[1].Date.ShouldEqual(new DateTime(2013, 11, 19, 17, 22, 52));
            comments[1].Text.ShouldEqual("Я опять на странице Дурова, опять передаю привет Маме, Бабушке и своим друзьям! Дела у меня очень отлично!");
            comments[1].Likes.Count.ShouldEqual(77);
            comments[1].Likes.UserLikes.ShouldEqual(false);
            comments[1].Likes.CanLike.ShouldEqual(true);
        }