public void NextButton_ProfilesChanged_ListensForProfileChanges() { var first = new UserProfile() { NextButton = new NextButton() { Height = 1 } }; var second = new UserProfile() { NextButton = new NextButton() { Height = 2 } }; _appSettings.SetupSequence(m => m.CurrentProfile) .Returns(first) .Returns(second); var vm = new NextButtonViewModel(_appSettings.Object, _dialog.Object, _session.Object, _messageBus.Object); bool raised = false; vm.PropertyChanged += (_, __) => raised = true; Assert.Equal(first.NextButton.Height, vm.Height); _appSettings.Raise(m => m.ProfileChanged += null, EventArgs.Empty); Assert.False(vm.IsEditing); Assert.True(raised); Assert.Equal(second.NextButton.Height, vm.Height); }
/// <summary> /// Initializes a new instance of the <see cref="ViewModelContainer"/> class. /// </summary> /// <param name="generalSettingsViewModel">Audioband view model.</param> /// <param name="albumArtPopupViewModel">Album art popup view model.</param> /// <param name="albumArtViewModel">Album art view model.</param> /// <param name="customLabelsViewModel">Custom labels view model.</param> /// <param name="nextButtonViewModel">Next button view model.</param> /// <param name="playPauseButtonViewModel">Play pause button view model.</param> /// <param name="repeatModeButtonViewModel">Repeat mode button view model.</param> /// <param name="shuffleModeButtonViewModel">Shuffle mode button view model.</param> /// <param name="previousButtonViewModel">Previous button view model.</param> /// <param name="progressBarViewModel">Progress bar view model.</param> /// <param name="audioSourceSettingsViewModel">Audio source settings view model.</param> public ViewModelContainer( GeneralSettingsViewModel generalSettingsViewModel, AlbumArtPopupViewModel albumArtPopupViewModel, AlbumArtViewModel albumArtViewModel, CustomLabelsViewModel customLabelsViewModel, NextButtonViewModel nextButtonViewModel, PlayPauseButtonViewModel playPauseButtonViewModel, RepeatModeButtonViewModel repeatModeButtonViewModel, ShuffleModeButtonViewModel shuffleModeButtonViewModel, PreviousButtonViewModel previousButtonViewModel, ProgressBarViewModel progressBarViewModel, AudioSourceSettingsViewModel audioSourceSettingsViewModel) { GeneralSettingsViewModel = generalSettingsViewModel; AlbumArtPopupViewModel = albumArtPopupViewModel; AlbumArtViewModel = albumArtViewModel; CustomLabelsViewModel = customLabelsViewModel; NextButtonViewModel = nextButtonViewModel; PlayPauseButtonViewModel = playPauseButtonViewModel; RepeatModeButtonViewModel = repeatModeButtonViewModel; ShuffleModeButtonViewModel = shuffleModeButtonViewModel; PreviousButtonViewModel = previousButtonViewModel; ProgressBarViewModel = progressBarViewModel; AudioSourceSettingsViewModel = audioSourceSettingsViewModel; }
public async Task NextButtonCommandCallsNextTrack() { _appSettings.SetupGet(m => m.NextButton).Returns(new NextButton()); var audioSourceMock = new Mock <IInternalAudioSource>(); audioSourceMock.Setup(m => m.NextTrackAsync()).Returns(Task.CompletedTask); _session.SetupGet(m => m.CurrentAudioSource).Returns(audioSourceMock.Object); var vm = new NextButtonViewModel(_appSettings.Object, _dialog.Object, _session.Object, _messageBus.Object); await vm.NextTrackCommand.ExecuteAsync(null); audioSourceMock.Verify(m => m.NextTrackAsync()); }