コード例 #1
0
        public async Task HandleWithPlaylistMessage_QueHasItemOfTypeAlbum_CallsSubsonicServiceGetAlbumAndAdsAllItsSongsToThePlaylist()
        {
            MockLoadModel();
            var subsonicModels = new List <ISubsonicModel> {
                new Common.Models.Subsonic.Album {
                    Id = 5
                }
            };
            var songs = new List <Song> {
                new Song(), new Song()
            };
            var album = new Common.Models.Subsonic.Album {
                Songs = songs
            };
            var mockGetAlbumResult = new MockGetAlbumResult {
                GetResultFunc = () => album
            };
            var callCount = 0;

            MockSubsonicService.GetAlbum = albumId =>
            {
                callCount++;
                albumId.Should().Be(5);
                return(mockGetAlbumResult);
            };

            await Task.Run(() => Subject.Handle(new PlaylistMessage {
                Queue = subsonicModels
            }));

            callCount.Should().Be(1);
            MockEventAggregator.Messages.All(m => m.GetType() == typeof(AddItemsMessage)).Should().BeTrue();
            MockEventAggregator.Messages.Count.Should().Be(2);
        }
コード例 #2
0
        public void TestInitialize()
        {
            IoC.GetInstance = (type, s) => null;

            _expandedArtist = new ExpandedArtist
            {
                Id         = 42,
                AlbumCount = 12,
                Name       = "artist"
            };
            _artistMenuItemViewModel   = _expandedArtist.AsMenuItemViewModel();
            _artistMusicDirectoryChild = _artistMenuItemViewModel.Item.As <ISubsonicModel>();

            _album = new Common.Models.Subsonic.Album
            {
                Id        = 24,
                SongCount = 12,
                Name      = "album"
            };
            _albumMenuItemViewModel   = _album.AsMenuItemViewModel();
            _albumMusicDirectoryChild = _albumMenuItemViewModel.Item.As <ISubsonicModel>();

            _song = new Song
            {
                Id     = 12,
                Title  = "song",
                Artist = "artist",
                Album  = "album"
            };
            _songMenuItemViewModel   = _song.AsMenuItemViewModel();
            _songMusicDirectoryChild = _songMenuItemViewModel.Item.As <ISubsonicModel>();
        }
コード例 #3
0
        public void TestInitialize()
        {
            IoC.GetInstance = (type, s) => null;

            _expandedArtist = new ExpandedArtist
                                  {
                                      Id = 42,
                                      AlbumCount = 12,
                                      Name = "artist"
                                  };
            _artistMenuItemViewModel = _expandedArtist.AsMenuItemViewModel();
            _artistMusicDirectoryChild = _artistMenuItemViewModel.Item.As<ISubsonicModel>();

            _album = new Common.Models.Subsonic.Album
                         {
                             Id = 24,
                             SongCount = 12,
                             Name = "album"
                         };
            _albumMenuItemViewModel = _album.AsMenuItemViewModel();
            _albumMusicDirectoryChild = _albumMenuItemViewModel.Item.As<ISubsonicModel>();

            _song = new Song
                        {
                            Id = 12,
                            Title = "song",
                            Artist = "artist",
                            Album = "album"
                        };
            _songMenuItemViewModel = _song.AsMenuItemViewModel();
            _songMusicDirectoryChild = _songMenuItemViewModel.Item.As<ISubsonicModel>();
        }