private void MusicSaveButton_Click(object sender, RoutedEventArgs e) { if (textBoxSinger.Text != "" && textBoxSongTitle.Text != "") { if (_activeController.Selected == null) { var newSong = new Song() { Singer = textBoxSinger.Text, Title = textBoxSongTitle.Text, File = _newFile }; _activeController.AddMedia(newSong); } else { var selectedSong = (Song)_activeController.Selected; if (_newFile == null) { _newFile = selectedSong.File; } selectedSong.Singer = textBoxSinger.Text; selectedSong.Title = textBoxSongTitle.Text; selectedSong.File = _newFile; _activeController.UpdateMedia(selectedSong); } _activeController.ClearSelected(); textBoxSinger.Text = ""; textBoxSongTitle.Text = ""; checkBoxMusicFilePresent.IsChecked = false; musicListBox.Items.Refresh(); } else { MessageBox.Show("Please fill in all the fields"); } }
public void ClearSelected_WhenSelectedIsSet_ShouldClearSelected() { //Arrange _sut = new TestMediaController(0); //Act _sut.ClearSelected(); //Assert Assert.IsNull(_sut.Selected); }