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 AddMedia_ShouldAddMediaItem() { // Arrange _sut = new TestMediaController(); Song song = new Song(); // Act _sut.AddMedia(song); // Assert Assert.IsTrue(_sut.List.Contains(song)); }