private async Task Authenticate(ITwitterAuthenticatedClient client) { // shared mutable state - won't be able to run tests in parallel HorribleOAuthHacks.Reset(); var uri = await client.GetAuthorizationUri(string.Concat(OAuthInterceptorUri, "/", HorribleOAuthHacks.OAuthCallBack)); //requires user interaction to authorize the app - brittle Process.Start(uri.ToString()); //wait until the user has completed the oauth flow - might time out or hang await Wait.Until(() => HorribleOAuthHacks.IsOAuthSigninCompleted); //authenticate the service await client.Authenticate(HorribleOAuthHacks.OAuthToken, HorribleOAuthHacks.OAuthVerifier); }
public void Dispose() { this.host?.Dispose(); HorribleOAuthHacks.Reset(); }