AddToPlaylist_QueHasItemOfTypeMusicDirectory_CallsSubsonicServiceGetMusicDirectoriesAndAddsAllSongsToThePlaylist() { MockLoadModel(); Subject.SelectedItems.Add(new MenuItemViewModel { Item = new MusicDirectory { Id = 5 } }); var children = new List <MusicDirectoryChild> { new MusicDirectoryChild(), new MusicDirectoryChild() }; var musicDirectory = new MusicDirectory { Children = children }; var mockGetAlbumResult = new MockGetMusicDirectoryResult { GetResultFunc = () => musicDirectory }; var callCount = 0; _mockSubsonicService.GetMusicDirectory = directoryId => { callCount++; directoryId.Should().Be(5); return(mockGetAlbumResult); }; await Subject.AddToPlaylist(); callCount.Should().Be(1); MockEventAggregator.Messages.All(m => m.GetType() == typeof(AddItemsMessage)).Should().BeTrue(); MockEventAggregator.Messages.Count.Should().Be(2); }
public async Task AddToPlaylist_QueHasItemOfTypeIndexItem_CallsSubsonicServiceGetMusicDirectoriesForEachChildArtist() { MockLoadModel(); Subject.SelectedItems.Add( new MenuItemViewModel { Item = new IndexItem { Id = 5, Artists = new List <Artist> { new Artist { Id = 3 } } } }); var children = new List <MusicDirectoryChild> { new MusicDirectoryChild(), new MusicDirectoryChild() }; var musicDirectory = new MusicDirectory { Children = children }; var mockGetMusicDirectoryResult = new MockGetMusicDirectoryResult { GetResultFunc = () => musicDirectory }; var callCount = 0; _mockSubsonicService.GetMusicDirectory = directoryId => { callCount++; directoryId.Should().Be(3); return(mockGetMusicDirectoryResult); }; await Subject.AddToPlaylist(); callCount.Should().Be(1); MockEventAggregator.Messages.All(m => m.GetType() == typeof(AddItemsMessage)).Should().BeTrue(); MockEventAggregator.Messages.Count.Should().Be(2); }
public void Setup() { _subject = new MusicDirectory(); }
public MusicFile(string filePath, MusicDirectory directory) { FilePath = filePath; Name = Path.GetFileNameWithoutExtension(filePath); Directory = directory; }