コード例 #1
0
 public PlaylistItemViewModel(PodcastPlayViewModel playViewModel, MediaItemViewModel model, bool isInPlaylist, int displayIndex, int totalPlaylistItems)
 {
     this.playViewModel = playViewModel;
     this.Model = model;
     this.IsInPlaylist = isInPlaylist;
     this.DisplayIndex = displayIndex;
     this.totalPlaylistItems = totalPlaylistItems;
 }
コード例 #2
0
        public void Playing_media_should_send_a_play_message_to_the_event_agg()
        {
            var eventAgg = new Mock<IEventAggregator>();
            var mediaItem = new MediaItem { Name = "test-item-to-play", IsAvailable = true };
            var model = new MediaItemViewModel(eventAgg.Object, mediaItem);
            model.PlayMediaItem();

            eventAgg.Verify(e => e.Publish(Match.Create<object>(m => MatchPlayRequestMessage(m, mediaItem))));
        }
コード例 #3
0
        public void Can_only_play_or_delete_media_when_media_is_available_and_not_deleted()
        {
            var eventAgg = new Mock<IEventAggregator>();
            var mediaItem = new MediaItem();
            var model = new MediaItemViewModel(eventAgg.Object, mediaItem);

            Assert.IsFalse(model.CanPlayMediaItem);
            Assert.IsFalse(model.CanDeleteMediaItem);

            mediaItem.IsAvailable = true;
            Assert.IsTrue(model.CanPlayMediaItem);
            Assert.IsTrue(model.CanDeleteMediaItem);

            model.DeleteMediaItem();
            Assert.IsFalse(model.CanPlayMediaItem);
            Assert.IsFalse(model.CanDeleteMediaItem);
        }