Пример #1
0
        private async void LoadFrontend()
        {
            try
            {
                await Connector.ConnectWithAPI();
            }
            catch (Exception ex)
            {
                var a = ex.Message.ToString();
                if (a != null)
                {
                    MessageBox.Show("You need internet connection to use Playlistening app");
                    System.Windows.Application.Current.Shutdown();
                }
            }

            Connector.GiveSpotifyAccessFor(Grabber);
            Grabber.UploadUserData(user);

            FrontManager Front = FrontManager.Instance;

            Front.loadMainWindowTools(UserName, UserImage, ListViewMenu);
            try
            {
                // change frontend
                Front.updateFrontend(user);
            }
            catch (Exception ex)
            {
                var a = ex.Message.ToString();
                Console.WriteLine(a);
            }

            CheckPlaylistArrows();
        }
Пример #2
0
        public async System.Threading.Tasks.Task GetEmptyUsernameTest()
        {
            APIConnector   Connector = new APIConnector();
            APIDataGrabber Grabber   = new APIDataGrabber(); // download data from API
            User           EmptyUser = new User("");

            await Connector.ConnectWithAPI();

            Connector.GiveSpotifyAccessFor(Grabber);
            Grabber.UploadUserData(EmptyUser);

            Assert.IsNull(EmptyUser.Name);
        }
Пример #3
0
        public async System.Threading.Tasks.Task GetPlaylistsImagesURLTest()
        {
            APIConnector   Connector = new APIConnector();
            APIDataGrabber Grabber   = new APIDataGrabber();                  // download data from API
            User           User      = new User("213pado37eomvngbs4vac5qra"); // Paweł Tomaszewski

            await Connector.ConnectWithAPI();

            Connector.GiveSpotifyAccessFor(Grabber);
            Grabber.UploadUserData(User);

            string expectedURL = "https://i.scdn.co/image/2654511f372969510abf52e52fee458ceeb15bed";

            Assert.AreEqual(expectedURL, User.Playlists[1].ImageURL);
        }
Пример #4
0
        public async System.Threading.Tasks.Task GetPlaylistsNamesTest()
        {
            APIConnector   Connector = new APIConnector();
            APIDataGrabber Grabber   = new APIDataGrabber();                  // download data from API
            User           User      = new User("213pado37eomvngbs4vac5qra"); // Paweł Tomaszewski

            await Connector.ConnectWithAPI();

            Connector.GiveSpotifyAccessFor(Grabber);
            Grabber.UploadUserData(User);

            string expectedPlaylistName = "Music";

            Assert.AreEqual(expectedPlaylistName, User.Playlists[1].Name);
        }
Пример #5
0
        public async System.Threading.Tasks.Task GetCorrectUsernameTest()
        {
            APIConnector   Connector = new APIConnector();
            APIDataGrabber Grabber   = new APIDataGrabber();                  // download data from API
            User           User      = new User("213pado37eomvngbs4vac5qra"); // Paweł Tomaszewski

            await Connector.ConnectWithAPI();

            Connector.GiveSpotifyAccessFor(Grabber);
            Grabber.UploadUserData(User);

            Assert.IsNotNull(User.Name);
            string expected = "Paweł Tomaszewski";

            Assert.AreEqual(expected, User.Name);
        }