Ejemplo n.º 1
0
 public void GetAndUpdateList_IDOfFirstAndFourthSongsShouldBeTheSameInBothListAndInsertedArray()
 {
     Playlist.Playlist playlist = new Playlist.Playlist();
     List<Song> songList = new List<Song>();
     songList.AddRange(new Song[] { new Song(1), new Song(2), new Song(3), new Song(4) });
     playlist.UpdateList(new ObservableCollection<Song>(songList));
     Assert.AreEqual(1, playlist.GetList()[0].ID);
     Assert.AreEqual(4, playlist.GetList()[3].ID);
 }
Ejemplo n.º 2
0
        public void GetAndUpdateList_IDOfFirstAndFourthSongsShouldBeTheSameInBothListAndInsertedArray()
        {
            Playlist.Playlist playlist = new Playlist.Playlist();
            List <Song>       songList = new List <Song>();

            songList.AddRange(new Song[] { new Song(1), new Song(2), new Song(3), new Song(4) });
            playlist.UpdateList(songList);
            Assert.AreEqual(1, playlist.GetList()[0].ID);
            Assert.AreEqual(4, playlist.GetList()[3].ID);
        }
Ejemplo n.º 3
0
 public void RemoveSong_IDsOfThirdSongShouldBe4AndFirstSongShouldBe2()
 {
     Playlist.Playlist playlist = new Playlist.Playlist();
     List<Song> songList = new List<Song>();
     songList.AddRange(new Song[] { new Song(1), new Song(2), new Song(3), new Song(4) });
     playlist.UpdateList(new ObservableCollection<Song>(songList));
     playlist.RemoveFromList(2);
     Assert.AreEqual(4, playlist.GetList()[2].ID);
     playlist.RemoveFromList(0);
     Assert.AreEqual(2, playlist.GetList()[0].ID);
 }
Ejemplo n.º 4
0
        public void RemoveSong_IDsOfThirdSongShouldBe4AndFirstSongShouldBe2()
        {
            Playlist.Playlist playlist = new Playlist.Playlist();
            List <Song>       songList = new List <Song>();

            songList.AddRange(new Song[] { new Song(1), new Song(2), new Song(3), new Song(4) });
            playlist.UpdateList(songList);
            playlist.RemoveFromList(2);
            Assert.AreEqual(4, playlist.GetList()[2].ID);
            playlist.RemoveFromList(0);
            Assert.AreEqual(2, playlist.GetList()[0].ID);
        }
Ejemplo n.º 5
0
 public void SortByDownloaded_PropertyDownloadedOfFirstAndSecondSongsShouldBeTrue()
 {
     Playlist.Playlist playlist = new Playlist.Playlist();
     List<Song> songList = new List<Song>();
     songList.AddRange(new Song[] { new Song(1), new Song(2), new Song(3), new Song(4) });
     songList[1].Downloaded = true;
     songList[3].Downloaded = true;
     playlist.UpdateList(songList);
     playlist.SortByDownloaded();
     Assert.AreEqual(true, playlist.GetList()[0].Downloaded);
     Assert.AreEqual(true, playlist.GetList()[1].Downloaded);
 }
Ejemplo n.º 6
0
        public void SortByDownloaded_PropertyDownloadedOfFirstAndSecondSongsShouldBeTrue()
        {
            Playlist.Playlist playlist = new Playlist.Playlist();
            List <Song>       songList = new List <Song>();

            songList.AddRange(new Song[] { new Song(1), new Song(2), new Song(3), new Song(4) });
            songList[1].Downloaded = true;
            songList[3].Downloaded = true;
            playlist.UpdateList(songList);
            playlist.SortByDownloaded();
            Assert.AreEqual(true, playlist.GetList()[0].Downloaded);
            Assert.AreEqual(true, playlist.GetList()[1].Downloaded);
        }
Ejemplo n.º 7
0
 public void AddToList_IDOfFirstThirdAndFiftsSongsShouldBe8()
 {
     Playlist.Playlist playlist = new Playlist.Playlist();
     List<Song> songList = new List<Song>();
     songList.AddRange(new Song[] { new Song(1), new Song(2), new Song(3), new Song(4) });
     playlist.UpdateList(new ObservableCollection<Song>(songList));
     Song insertedSong = new Song(8);
     playlist.AddToList(insertedSong, 0);
     Assert.AreEqual(insertedSong.ID, playlist.GetList()[0].ID);
     playlist.AddToList(insertedSong, 5);
     Assert.AreEqual(insertedSong.ID, playlist.GetList()[5].ID);
     playlist.AddToList(insertedSong, 3);
     Assert.AreEqual(insertedSong.ID, playlist.GetList()[3].ID);
 }
Ejemplo n.º 8
0
        public void AddToList_IDOfFirstThirdAndFiftsSongsShouldBe8()
        {
            Playlist.Playlist playlist = new Playlist.Playlist();
            List <Song>       songList = new List <Song>();

            songList.AddRange(new Song[] { new Song(1), new Song(2), new Song(3), new Song(4) });
            playlist.UpdateList(songList);
            Song insertedSong = new Song(8);

            playlist.AddToList(insertedSong, 0);
            Assert.AreEqual(insertedSong.ID, playlist.GetList()[0].ID);
            playlist.AddToList(insertedSong, 5);
            Assert.AreEqual(insertedSong.ID, playlist.GetList()[5].ID);
            playlist.AddToList(insertedSong, 3);
            Assert.AreEqual(insertedSong.ID, playlist.GetList()[3].ID);
        }
Ejemplo n.º 9
0
 public void MoveSong_IDOfThirdSongShouldBe1()
 {
     Playlist.Playlist playlist = new Playlist.Playlist();
     List<Song> songList = new List<Song>();
     songList.AddRange(new Song[] { new Song(1), new Song(2), new Song(3), new Song(4) });
     playlist.UpdateList(new ObservableCollection<Song>(songList));
     playlist.MoveSong(0, 2);
     Assert.AreEqual(1, playlist.GetList()[2].ID);
 }
Ejemplo n.º 10
0
        public void MoveSong_IDOfThirdSongShouldBe1()
        {
            Playlist.Playlist playlist = new Playlist.Playlist();
            List <Song>       songList = new List <Song>();

            songList.AddRange(new Song[] { new Song(1), new Song(2), new Song(3), new Song(4) });
            playlist.UpdateList(songList);
            playlist.MoveSong(0, 2);
            Assert.AreEqual(1, playlist.GetList()[2].ID);
        }
Ejemplo n.º 11
0
 public void AddToList_IDOfFirstSongInArrayAndFifthSongInListShouldBeTheSame()
 {
     Playlist.Playlist playlist = new Playlist.Playlist();
     List<Song> songList = new List<Song>();
     songList.AddRange(new Song[] { new Song(1), new Song(2), new Song(3), new Song(4) });
     playlist.UpdateList(new ObservableCollection<Song>(songList));
     Song[] insertedArrayOfSongs = new Song[] { new Song(9), new Song(8), new Song(7) };
     playlist.AddToList(insertedArrayOfSongs, 4);
     Assert.AreEqual(insertedArrayOfSongs[0].ID, playlist.GetList()[4].ID);
 }
Ejemplo n.º 12
0
        public void AddToList_IDOfFirstSongInArrayAndFifthSongInListShouldBeTheSame()
        {
            Playlist.Playlist playlist = new Playlist.Playlist();
            List <Song>       songList = new List <Song>();

            songList.AddRange(new Song[] { new Song(1), new Song(2), new Song(3), new Song(4) });
            playlist.UpdateList(songList);
            Song[] insertedArrayOfSongs = new Song[] { new Song(9), new Song(8), new Song(7) };
            playlist.AddToList(insertedArrayOfSongs, 4);
            Assert.AreEqual(insertedArrayOfSongs[0].ID, playlist.GetList()[4].ID);
        }
        private void buttonDownload_Click(object sender, RoutedEventArgs e)
        {
            List <Song> ListToDownload = new List <Song>();

            if (sender.GetHashCode() == buttonDownload.GetHashCode())
            {
                ListToDownload.Add(Playlist1.GetList()[_CurrentSong]);
            }
            else
            {
                ListToDownload = Playlist1.GetList();
            }
            if (Downloader1.DownloadSong(ListToDownload) == Common.Common.Status.Error)
            {
                MessageBox.Show("Ошибка скачивания", "", MessageBoxButton.OK);
            }
        }