예제 #1
0
 public void Initialize()
 {
     ValidateConfiguration();
     SoundCloudApiUnAuthenticated = SoundCloudApi.CreateClient(TestSettings.ClientId);
     PasswordCredentialsState     = new PasswordCredentialsState();
     SoundCloudApiAuthenticated   = SoundCloudApi.CreateClient(TestSettings.ClientId, TestSettings.ClientSecret, TestSettings.UserName, TestSettings.Password, PasswordCredentialsState);
 }
예제 #2
0
        public void TestGetUserWithOAuthRequestForceRefresh()
        {
            SoundCloudApiAuthenticated.User().Get();

            var token = PasswordCredentialsState.Load();

            token.ExpiresIn = 1;
            // Override the usual hour long session soundcloud sends back

            while (!token.HasExpired())
            {
                Thread.Sleep(100);
            }
            PasswordCredentialsState.Save(token);

            SoundCloudApiAuthenticated = SoundCloudApi.CreateClient(TestSettings.ClientId, TestSettings.ClientSecret, PasswordCredentialsState);
            var user = SoundCloudApiAuthenticated.User().Get();

            Assert.IsNotEmpty(user.Username);
        }