Ejemplo n.º 1
0
        public void Get_NotExtended()
        {
            const string url  = "https://api.vk.com/method/video.get?owner_id=1&width=320&count=3&offset=2&extended=0&v=5.9&access_token=token";
            const string json =
                @"{
                    'response': {
                      'count': 8,
                      'items': [
                        {
                          'id': 166481021,
                          'owner_id': 1,
                          'title': 'Лидия Аркадьевна',
                          'duration': 131,
                          'description': '',
                          'date': 1384867255,
                          'views': 81676,
                          'comments': 2098,
                          'photo_130': 'http://cs419529.vk.me/u9258277/video/s_af2727af.jpg',
                          'photo_320': 'http://cs419529.vk.me/u9258277/video/l_aba9c1ab.jpg',
                          'player': 'http://www.youtube.com/embed/VQaHFisdf-s'
                        },
                        {
                          'id': 166468673,
                          'owner_id': 1,
                          'title': 'Лидия Аркадьевна',
                          'duration': 62,
                          'description': '',
                          'date': 1384721483,
                          'views': 42107,
                          'comments': 1243,
                          'photo_130': 'http://cs409217.vk.me/u9258277/video/s_4e281f24.jpg',
                          'photo_320': 'http://cs409217.vk.me/u9258277/video/l_aa616ea2.jpg',
                          'player': 'http://www.youtube.com/embed/YfLytrkbAfM'
                        },
                        {
                          'id': 164841344,
                          'owner_id': 1,
                          'title': 'This is SPARTA',
                          'duration': 16,
                          'description': '',
                          'date': 1366495075,
                          'views': 218658,
                          'comments': 2578,
                          'photo_130': 'http://cs12761.vk.me/u5705167/video/s_df53315c.jpg',
                          'photo_320': 'http://cs12761.vk.me/u5705167/video/l_00c6be47.jpg',
                          'player': 'http://vk.com/video_ext.php?oid=1&id=164841344&hash=c8de45fc73389353'
                        }
                      ]
                    }
                  }";

            VideoCategory cat = GetMockedVideoCategory(url, json);

            ReadOnlyCollection <Video> result = cat.Get(1, width: VideoWidth.Large320, count: 3, offset: 2);

            result.Count.ShouldEqual(3);
            result[0].Id.ShouldEqual(166481021);
            result[0].OwnerId.ShouldEqual(1);
            result[0].Title.ShouldEqual("Лидия Аркадьевна");
            result[0].Duration.ShouldEqual(131);
            result[0].Date.ShouldEqual(new DateTime(2013, 11, 19, 17, 20, 55));
            result[0].ViewsCount.ShouldEqual(81676);
            result[0].CommentsCount.ShouldEqual(2098);
            result[0].Photo130.ShouldEqual(new Uri("http://cs419529.vk.me/u9258277/video/s_af2727af.jpg"));
            result[0].Photo320.ShouldEqual(new Uri("http://cs419529.vk.me/u9258277/video/l_aba9c1ab.jpg"));
            result[0].Player.ShouldEqual(new Uri("http://www.youtube.com/embed/VQaHFisdf-s"));

            result[1].Id.ShouldEqual(166468673);
            result[1].OwnerId.ShouldEqual(1);
            result[1].Title.ShouldEqual("Лидия Аркадьевна");
            result[1].Duration.ShouldEqual(62);
            result[1].Description.ShouldEqual(string.Empty);
            result[1].Date.ShouldEqual(new DateTime(2013, 11, 18, 0, 51, 23));
            result[1].ViewsCount.ShouldEqual(42107);
            result[1].CommentsCount.ShouldEqual(1243);
            result[1].Photo130.ShouldEqual(new Uri("http://cs409217.vk.me/u9258277/video/s_4e281f24.jpg"));
            result[1].Photo320.ShouldEqual(new Uri("http://cs409217.vk.me/u9258277/video/l_aa616ea2.jpg"));
            result[1].Player.ShouldEqual(new Uri("http://www.youtube.com/embed/YfLytrkbAfM"));

            result[2].Id.ShouldEqual(164841344);
            result[2].OwnerId.ShouldEqual(1);
            result[2].Title.ShouldEqual("This is SPARTA");
            result[2].Duration.ShouldEqual(16);
            result[2].Description.ShouldEqual(string.Empty);
            result[2].Date.ShouldEqual(new DateTime(2013, 4, 21, 1, 57, 55));
            result[2].ViewsCount.ShouldEqual(218658);
            result[2].CommentsCount.ShouldEqual(2578);
            result[2].Photo130.ShouldEqual(new Uri("http://cs12761.vk.me/u5705167/video/s_df53315c.jpg"));
            result[2].Photo320.ShouldEqual(new Uri("http://cs12761.vk.me/u5705167/video/l_00c6be47.jpg"));
            result[2].Player.ShouldEqual(new Uri("http://vk.com/video_ext.php?oid=1&id=164841344&hash=c8de45fc73389353"));
        }