public void MultipleSongsWithDifferentArtistReturnsEmptyString() { var songs = new[] { Helpers.LocalSong1, Helpers.LocalSong2 }; var fixture = new TagEditorViewModel(songs, () => Task.FromResult(true)); Assert.Equal(string.Empty, fixture.Artist); }
public void SingleSongReturnsSongAlbum() { var songs = new[] { Helpers.LocalSong1 }; var fixture = new TagEditorViewModel(songs, () => Task.FromResult(true)); Assert.Equal(Helpers.LocalSong1.Album, fixture.Album); }
public void ReturnsCustomValueIfSet() { var songs = new[] { Helpers.LocalSong1 }; var fixture = new TagEditorViewModel(songs, () => Task.FromResult(true)) { Album = "Custom Album" }; Assert.Equal("Custom Album", fixture.Album); }
public void MultipleSongsWithSameArtistReturnsCommonAlbum() { var song1 = new LocalSong("C://song1.mp3", TimeSpan.Zero) { Album = "The Album" }; var song2 = new LocalSong("C://song2.mp3", TimeSpan.Zero) { Album = "The Album" }; var songs = new[] { song1, song2 }; var fixture = new TagEditorViewModel(songs, () => Task.FromResult(true)); Assert.Equal(song1.Album, fixture.Album); }
private void OpenTagEditor() { Func<Task<bool>> multipleEditWarning = async () => { MessageDialogResult result = await this.ShowMessageAsync("Save Metadata", "Do you really want to change the metadata of multiple songs?", MessageDialogStyle.AffirmativeAndNegative, new MetroDialogSettings { AffirmativeButtonText = "Save", NegativeButtonText = "Cancel" }); return result == MessageDialogResult.Affirmative; }; var songs = this.shellViewModel.LocalViewModel.SelectedSongs.Select(x => (LocalSong)x.Model).ToList(); var editorViewModel = new TagEditorViewModel(songs, multipleEditWarning); this.TagEditor.Content = new TagEditorView { DataContext = editorViewModel }; editorViewModel.Finished.FirstAsync() .Subscribe(_ => this.TagEditorFlyout.IsOpen = false); this.TagEditorFlyout.IsOpen = true; }
public async Task InvokesWarningIfMoreThanOneSong() { bool called = false; var songs = new[] { Helpers.LocalSong1, Helpers.LocalSong2 }; var fixture = new TagEditorViewModel(songs, () => Task.Run(() => { called = true; return false; })); await fixture.Save.ExecuteAsync(); Assert.True(called); }
public async Task FiresWhenCancelCommandInvoked() { var songs = new[] { Helpers.LocalSong1 }; var fixture = new TagEditorViewModel(songs, () => Task.FromResult(true)); var finished = fixture.Finished.CreateCollection(); await fixture.Cancel.ExecuteAsync(); Assert.Equal(1, finished.Count); }