[MTest] public void HandleTokenRefreshFailed() { Autoya.forceFailTokenRefresh = true; var tokenRefreshFailed = false; Autoya.Auth_SetOnRefreshAuthFailed( (code, reason) => { tokenRefreshFailed = true; } ); // forcibly get 401 response. Autoya.Http_Get( "https://httpbin.org/status/401", (string conId, string resultData) => { // do nothing. }, (conId, code, reason, autoyaStatus) => { // do nothing. } ); WaitUntil( () => tokenRefreshFailed, 10, "failed to handle tokenRefreshFailed." ); Autoya.forceFailTokenRefresh = false; }
public IEnumerator HandleTokenRefreshFailed() { Autoya.forceFailTokenRefresh = true; var tokenRefreshFailed = false; Autoya.Auth_SetOnRefreshAuthFailed( (code, reason) => { tokenRefreshFailed = true; } ); // forcibly get 401 response. Autoya.Http_Get( "https://httpbin.org/status/401", (conId, resultData) => { // do nothing. }, (conId, code, reason, autoyaStatus) => { // do nothing. } ); yield return(WaitUntil( () => tokenRefreshFailed, () => { throw new TimeoutException("failed to handle tokenRefreshFailed."); }, 20 )); Autoya.forceFailTokenRefresh = false; }