Пример #1
0
 public static void EnsureValidResponse(ApiResponse response, bool checkForSuccesss = true)
 {
     Assert.IsNotNull(response, "Api response is null.");
     Assert.IsNotNull(response.Status, "Response.Status is null.");
     if (checkForSuccesss == true)
     {
         if (response.Status.IsSuccessful == false)
             Assert.Fail(response.Status.Message);
     }
 }
Пример #2
0
 internal bool ShouldLog(ApiRequest request, ApiResponse response, long responseTimeInMs)
 {
     if (InternalApp.Debug.ApiLogging.MatchLogLevel(ApiLogFlags.None) == true)
         return false;
     else if (InternalApp.Debug.ApiLogging.MatchLogLevel(ApiLogFlags.Everything) == true)
         return true;
     else if (InternalApp.Debug.ApiLogging.MatchLogLevel(ApiLogFlags.Conditional) == true)
     {
         if (_condition != null && _condition(request, response) == true)
             return true;
     }
     else
     {
         if (InternalApp.Debug.ApiLogging.MatchLogLevel(ApiLogFlags.FailedCalls))
         {
             if (response == null) return true;
             if (response.Status == null) return true;
             if (response.Status.IsSuccessful == false) return true;
         }
         if (InternalApp.Debug.ApiLogging.MatchLogLevel(ApiLogFlags.SlowLogs) && responseTimeInMs > _slowLogThresholdInMilliSeconds)
             return true;
     }
     return false;
 }