コード例 #1
0
        public void TestClickingAVideoCategory()
        {
            this._model.HistoryStack = new Stack <ObservableCollection <VideoComponent> >();

            VideoComponent category = new VideoCategory("User Testimonials", "/storage/sdcard0/SalesApp/Videos/User Testimonials/");

            ObservableCollection <VideoComponent> categories = new ObservableCollection <VideoComponent>()
            {
                category
            };

            this._model.VideoComponents = categories;

            VideoComponent video1 = new SalesApp.Core.BL.Models.Modules.Videos.Video("Video 1", "/storage/sdcard0/SalesApp/Videos/User Testimonials/Video 1.MP4");
            VideoComponent video2 = new SalesApp.Core.BL.Models.Modules.Videos.Video("Video 2", "/storage/sdcard0/SalesApp/Videos/User Testimonials/Video 2.MP4");

            category.Add(video1);
            category.Add(video2);

            // Play a video
            this._model.VideoComponentClicked(category);

            ObservableCollection <VideoComponent> videos = new ObservableCollection <VideoComponent>()
            {
                video1,
                video2
            };

            // Test expected model states
            Assert.That(this._model.Title, Is.EqualTo("User Testimonials"));
            Assert.That(this._model.VideoComponents, Is.EqualTo(videos));
            Assert.That(this._model.HistoryStack.Peek(), Is.EqualTo(categories));
        }
コード例 #2
0
ファイル: VideoCategoryTest.cs プロジェクト: odugen/vk
        public void Add_NormalCase()
        {
            const string url  = "https://api.vk.com/method/video.add?video_id=164841344&owner_id=1&v=5.9&access_token=token";
            const string json =
                @"{
                    'response': 167593944
                  }";

            VideoCategory cat = GetMockedVideoCategory(url, json);

            long id = cat.Add(164841344, 1);

            id.ShouldEqual(167593944);
        }
コード例 #3
0
        private List <VideoComponent> EnumarateFolder(string folderPath)
        {
            File baseFolder = new File(folderPath);

            File[] files = baseFolder.ListFiles();
            List <VideoComponent> list = new List <VideoComponent>();

            foreach (File file in files)
            {
                if (file.IsHidden || file.IsFile)
                {
                    continue;
                }

                File assetsFolder = new File(file.AbsolutePath + "/assets");
                if (!Directory.Exists(assetsFolder.AbsolutePath))
                {
                    Directory.CreateDirectory(assetsFolder.AbsolutePath);
                }

                if (file.IsDirectory)
                {
                    VideoComponent videoCategory = new VideoCategory(file.Name, folderPath);
                    string         iconPath      = GetVideoComponentIcon(videoCategory, assetsFolder);

                    if (new File(iconPath).Exists())
                    {
                        videoCategory.ThumbNailUrl = iconPath;
                    }

                    string innerFolderPath = this.VideosFolder + file.Name + "/";
                    File   innerFoler      = new File(innerFolderPath);

                    File[] innerFiles = innerFoler.ListFiles();
                    foreach (var innerFile in innerFiles)
                    {
                        if (innerFile.IsHidden || IsAssetsFolder(innerFile))
                        {
                            continue;
                        }

                        VideoComponent component;
                        if (innerFile.IsDirectory)
                        {
                            component = new VideoCategory(innerFile.Name, innerFolderPath);
                        }
                        else
                        {
                            component = new Video(innerFile.Name, innerFolderPath);
                        }

                        iconPath = GetVideoComponentIcon(component, assetsFolder);

                        if (new File(iconPath).Exists())
                        {
                            component.ThumbNailUrl = iconPath;
                        }

                        videoCategory.Add(component);
                    }

                    list.Add(videoCategory);
                }
                else
                {
                    VideoComponent video = new Video(file.Name, folderPath);
                    list.Add(video);
                }
            }

            return(list);
        }