Пример #1
0
        public void SetUp()
        {
            this.videoFilter = new VideoFilter();
            this.videos      = new List <IListVideoInfo>();
            var video1 = new NonBindableListVideoInfo()
            {
                Tags = new List <string>()
                {
                    "東方", "テスト"
                }
            };
            var video2 = new NonBindableListVideoInfo()
            {
                Tags = new List <string>()
                {
                    "MMD", "テスト"
                }
            };
            var video3 = new NonBindableListVideoInfo()
            {
                Tags = new List <string>()
                {
                    "IDOL_M@STER", "テスト"
                }
            };
            var video4 = new NonBindableListVideoInfo()
            {
                Tags = new List <string>()
                {
                    "最古の動画", "sm9", "テスト"
                }
            };
            var video5 = new NonBindableListVideoInfo()
            {
                Tags = new List <string>()
                {
                    "タグ", "テスト"
                }
            };

            video1.Title.Value = "テスト東方";
            video1.Id.Value    = 1;
            video2.Title.Value = "テストMMD";
            video2.Id.Value    = 2;
            video3.Title.Value = "テストIDOL M@STER";
            video3.Id.Value    = 3;
            video4.Title.Value = "レッツゴー!陰陽師";
            video4.Id.Value    = 4;
            video5.Title.Value = "タグテスト";
            video5.Id.Value    = 5;
            this.videos.AddRange(new List <IListVideoInfo>()
            {
                video1, video2, video3, video4, video5
            });
        }
        public void 存在しない動画を削除する()
        {
            var video = new NonBindableListVideoInfo();

            video.NiconicoId.Value = "sm9";
            var result = this.videoListContainer !.Remove(video);

            Assert.That(this.lastVIdeoNicoID, Is.Null);
            Assert.That(this.videoListContainer.Videos.Count, Is.EqualTo(0));
            Assert.That(result.IsSucceeded, Is.False);
        }
        public void 動画を追加する()
        {
            var video = new NonBindableListVideoInfo();

            video.NiconicoId.Value = "sm9";
            video.IsSelected.Value = true;
            var result = this.videoListContainer !.Add(video, 1);

            Assert.That(this.lastChangeType, Is.EqualTo(ChangeType.Add));
            Assert.That(this.lastVIdeoNicoID, Is.EqualTo("sm9"));
            Assert.That(this.videoListContainer.Videos.Count, Is.EqualTo(1));
            Assert.That(result.IsSucceeded, Is.True);
            Assert.That(this.cStab !.SelectedVideos.Value, Is.EqualTo(1));
        }
Пример #4
0
        public void 動画情報を変換する()
        {
            var video = new NonBindableListVideoInfo();

            video.Title.Value      = "Hello World";
            video.NiconicoId.Value = "0";

            var task = new Download::DownloadTask(new PlaylistHandlerStub(), new MessageHandlerStub(), new ContentDownloadHelperStub(), new VideoListContainerStub(), new VideosUncheckerStub());

            task.Initialize(video, new DownloadSettings()
            {
                PlaylistID = 1
            });

            Assert.That(task.Title, Is.EqualTo("Hello World"));
            Assert.That(task.PlaylistID, Is.EqualTo(1));
            Assert.That(task.NiconicoID, Is.EqualTo("0"));
        }
        public void 動画を更新する()
        {
            var count    = 100;
            var original = new NonBindableListVideoInfo()
            {
                NiconicoId = new Reactive.Bindings.ReactiveProperty <string>("1")
            };
            var newItem = new NonBindableListVideoInfo()
            {
                NiconicoId = new Reactive.Bindings.ReactiveProperty <string>("1"), ViewCount = new Reactive.Bindings.ReactiveProperty <int>(count)
            };

            this.videoListContainer !.Add(original);
            IAttemptResult result = this.videoListContainer.Update(newItem);

            IListVideoInfo video = this.videoListContainer.Videos.First();

            Assert.That(result.IsSucceeded, Is.True);
            Assert.That(video.ViewCount.Value, Is.EqualTo(count));
        }
        public void 動画を並び替える(VideoSortType sortType, int expectedID)
        {
            var video1 = new NonBindableListVideoInfo()
            {
                Id = new Reactive.Bindings.ReactiveProperty <int>(1), Title = new Reactive.Bindings.ReactiveProperty <string>("3"), NiconicoId = new Reactive.Bindings.ReactiveProperty <string>("3")
            };
            var video2 = new NonBindableListVideoInfo()
            {
                Id = new Reactive.Bindings.ReactiveProperty <int>(2), Title = new Reactive.Bindings.ReactiveProperty <string>("2"), NiconicoId = new Reactive.Bindings.ReactiveProperty <string>("2")
            };
            var video3 = new NonBindableListVideoInfo()
            {
                Id = new Reactive.Bindings.ReactiveProperty <int>(3), Title = new Reactive.Bindings.ReactiveProperty <string>("1"), NiconicoId = new Reactive.Bindings.ReactiveProperty <string>("1")
            };

            this.videoListContainer !.AddRange(new IListVideoInfo[] { video1, video2, video3 });
            this.videoListContainer !.Sort(sortType, false);

            Assert.That(this.videoListContainer !.Videos.First().Id.Value, Is.EqualTo(expectedID));
        }
        public void 動画をひとつ後ろに挿入する(int index, bool expectedResult, int lastID)
        {
            var video1 = new NonBindableListVideoInfo()
            {
                Id = new Reactive.Bindings.ReactiveProperty <int>(1), Title = new Reactive.Bindings.ReactiveProperty <string>("3"), NiconicoId = new Reactive.Bindings.ReactiveProperty <string>("1")
            };
            var video2 = new NonBindableListVideoInfo()
            {
                Id = new Reactive.Bindings.ReactiveProperty <int>(2), Title = new Reactive.Bindings.ReactiveProperty <string>("2"), NiconicoId = new Reactive.Bindings.ReactiveProperty <string>("2")
            };
            var video3 = new NonBindableListVideoInfo()
            {
                Id = new Reactive.Bindings.ReactiveProperty <int>(3), Title = new Reactive.Bindings.ReactiveProperty <string>("1"), NiconicoId = new Reactive.Bindings.ReactiveProperty <string>("3")
            };

            this.videoListContainer !.AddRange(new IListVideoInfo[] { video1, video2, video3 });

            var result = this.videoListContainer.MovevideotoForward(index);

            Assert.That(result.IsSucceeded, Is.EqualTo(expectedResult));
            Assert.That(this.videoListContainer.Videos[2].Id.Value, Is.EqualTo(lastID));
        }
        public void すべての動画にチェックを入れる()
        {
            void check(bool value)
            {
                if (value)
                {
                    this.cStab !.SelectedVideos.Value++;
                }
            }

            var video1 = new NonBindableListVideoInfo()
            {
                NiconicoId = new Reactive.Bindings.ReactiveProperty <string>("1")
            };
            var video2 = new NonBindableListVideoInfo()
            {
                NiconicoId = new Reactive.Bindings.ReactiveProperty <string>("2")
            };
            var video3 = new NonBindableListVideoInfo()
            {
                NiconicoId = new Reactive.Bindings.ReactiveProperty <string>("3")
            };

            video1.IsSelected.Subscribe(value => check(value));
            video2.IsSelected.Subscribe(value => check(value));
            video3.IsSelected.Subscribe(value => check(value));

            this.videoListContainer !.AddRange(new IListVideoInfo[] { video1, video2, video3 });
            this.videoListContainer !.ForEach(v => v.IsSelected.Value = true);


            foreach (var video in this.videoListContainer !.Videos)
            {
                Assert.That(video.IsSelected.Value, Is.True);
            }

            Assert.That(this.cStab !.SelectedVideos.Value, Is.EqualTo(3));
        }