public void Initialize() { ValidateConfiguration(); SoundCloudApiUnAuthenticated = SoundCloudApi.CreateClient(TestSettings.ClientId); PasswordCredentialsState = new PasswordCredentialsState(); SoundCloudApiAuthenticated = SoundCloudApi.CreateClient(TestSettings.ClientId, TestSettings.ClientSecret, TestSettings.UserName, TestSettings.Password, PasswordCredentialsState); }
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); }