public void AddUser_IDOfSecondSongShouldBe2() { UserManager.UserManager users = new UserManager.UserManager(); List<Song> userSongList = new List<Song>(new Song[] { new Song(1), new Song(2), new Song(3), new Song(4) }); users.AddUser(new User("1", "1", userSongList)); Assert.AreEqual(2, users.GetUserListOfSongs("1")[1].ID); }
public void AddUser_IDOfSecondSongShouldBe2() { UserManager.UserManager users = new UserManager.UserManager(); List <Song> userSongList = new List <Song>(new Song[] { new Song(1), new Song(2), new Song(3), new Song(4) }); users.AddUser(new User("1", "1", userSongList)); Assert.AreEqual(2, users.GetUserListOfSongs("1")[1].ID); }
public void UpdateUserListOfSongs_IDOfFourthSongShouldBe8() { UserManager.UserManager users = new UserManager.UserManager(); List<Song> userSongList = new List<Song>(new Song[] { new Song(1), new Song(2), new Song(3), new Song(4) }); List<Song> userSongListUpdated = new List<Song>(new Song[] { new Song(5), new Song(6), new Song(7), new Song(8) }); users.AddUser(new User("1", "1", userSongList)); users.UpdateUserListOfSongs("1", userSongListUpdated); Assert.AreEqual(8, users.GetUserListOfSongs("1")[3].ID); }
public void UpdateUserListOfSongs_IDOfFourthSongShouldBe8() { UserManager.UserManager users = new UserManager.UserManager(); List <Song> userSongList = new List <Song>(new Song[] { new Song(1), new Song(2), new Song(3), new Song(4) }); List <Song> userSongListUpdated = new List <Song>(new Song[] { new Song(5), new Song(6), new Song(7), new Song(8) }); users.AddUser(new User("1", "1", userSongList)); users.UpdateUserListOfSongs("1", userSongListUpdated); Assert.AreEqual(8, users.GetUserListOfSongs("1")[3].ID); }
private void SetUser(User user, bool wasAlreadyEnteringThroughThisApp) { Player1.StopAndStopTimer(); _CurrentUser = user; if (!wasAlreadyEnteringThroughThisApp) { UserManager1.AddUser(user); Playlist1.UpdateList(user.SongList); Infrastructure1.SaveListOfUsers(UserManager1.GetListOfUsers()); } else { List <Song> SongList = new List <Song>(VKAPI1.GetAudioExternal(user.ID, user.AccessToken)); UserManager1.UpdateUserListOfSongs(user.ID, SongList); Playlist1.UpdateList(SongList); MenuButtonImage.Source = new BitmapImage(new Uri("/Resources/Pictures/menu.png", UriKind.Relative)); listboxMenu.Visibility = Visibility.Hidden; listboxMenu.UnselectAll(); listboxLoginAs.Visibility = Visibility.Hidden; listboxLoginAs.UnselectAll(); } if (user.SongList.Count > 0) { _CurrentSong = 0; Player1.SetSource(user.SongList[_CurrentSong]); RenderPlaylist(user.SongList); RenderNameAndSelectedSong(); Player1.SetTimer(_updateInterval, timerUpdate_Tick); Player1.PlayAndStartTimer(); } else { if (!wasAlreadyEnteringThroughThisApp) { MessageBox.Show("У данного пользователя нет аудиозаписей.", "VVKMusic информация", MessageBoxButton.OK, MessageBoxImage.Information); } else { MessageBox.Show("Вконтакте сообщает, что аудиозаписей нет. Если на данном аккаунте есть аудиозаписи, возможно Вам нужно залогиниться заново.", "VVKMusic информация", MessageBoxButton.OK, MessageBoxImage.Information); } } }