private Viedo GetCustomerById(int id)
 {
     try
     {
         return(Videos.First(x => x.Id == id));
     }
     catch
     {
         return(null);
     }
 }
Пример #2
0
        /// <summary>
        /// ビデオ情報をマージします。
        /// </summary>
        /// <param name="video">マージするビデオ情報</param>
        public void VideoMerge(VideoModel video)
        {
            if (Videos.Any(v => v.VideoId == video.VideoId))
            {
                var v = Videos.First(temp => temp.VideoId == video.VideoId);

                // 更新要素を再設定
                v.ViewCounter    = video.ViewCounter;
                v.MylistCounter  = video.MylistCounter;
                v.CommentCounter = video.CommentCounter;
                v.LastResBody    = video.LastResBody;
            }
            else
            {
                // 追加
                Videos.Add(video);
            }
        }
        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));
        }