public ReportRequestInfo PollReportStatus(string reportRequestId, out ReportRequestInfoStatus reportRequestInfoStatus) { if (string.IsNullOrEmpty(reportRequestId)) { throw new ArgumentNullException("reportRequestId is empty"); } ReportRequestInfo reportRequestInfo = null; reportRequestInfoStatus = ReportRequestInfoStatus.Unknown; int sleepTime = 5000; for (int i = 0; i < 6; i++) { nLogger.Info("GetReportRequestInfo polling for reportRequestId: " + reportRequestId); reportRequestInfo = GetReportRequestInfo(reportRequestId); reportRequestInfoStatus = GetReportRequestInfoStatus(reportRequestInfo); if (reportRequestInfoStatus == ReportRequestInfoStatus.ReportPending || reportRequestInfoStatus == ReportRequestInfoStatus.Unknown) { Thread.Sleep(sleepTime); sleepTime = sleepTime + sleepTime; } else { break; } } return(reportRequestInfo); }
public void GetReportRequestInfoStatus_ReportFailed() { ReportRequestInfo reportRequestInfo = new ReportRequestInfo(); reportRequestInfo.ReportRequestId = ""; reportRequestInfo.ReportProcessingStatus = "_CANCELLED_"; ReportRequestInfoStatus status = reportHandler.GetReportRequestInfoStatus(reportRequestInfo); Console.Write(status.ToString()); Assert.AreEqual(ReportRequestInfoStatus.ReportFailed, status); }