Exemple #1
0
        public void IsEmptyContent_NullContent()
        {
            string          inventory       = "";
            GetReportResult getReportResult = new GetReportResult();


            Assert.IsTrue(getReportResult.IsEmptyContent());
        }
Exemple #2
0
        public void IsEmptyContent_OneLineHeadersOnly()
        {
            string          inventory       = File.ReadAllText(@"report_samples\_GET_FLAT_FILE_ALL_ORDERS_DATA_BY_ORDER_DATE_empty.txt");
            GetReportResult getReportResult = new GetReportResult();

            getReportResult.Content = inventory;

            Assert.IsTrue(getReportResult.IsEmptyContent());
        }
Exemple #3
0
        public void IsEmptyContent_NotEmpty()
        {
            string          inventory       = File.ReadAllText(@"report_samples\_GET_FBA_MYI_ALL_INVENTORY_DATA_.txt");
            GetReportResult getReportResult = new GetReportResult();

            getReportResult.Content = inventory;

            Assert.IsFalse(getReportResult.IsEmptyContent());
        }
        public GetReportResult GetReport(string reportType, DateTime startDate, DateTime endDate, string fileLocation)
        {
            GetReportResult report = new GetReportResult();

            ReportRequestInfoStatus reportRequestInfoStatus;
            RequestReportResult     requestReportResult = reportHandler.RequestReport(reportType, startDate, endDate);
            ReportRequestInfo       reportRequestInfo   = reportHandler.PollReportStatus(requestReportResult.ReportRequestInfo.ReportRequestId, out reportRequestInfoStatus);

            string writePath = reportHandler.CreateFileLocation(fileLocation, serviceContext.SellerId, reportType, startDate, endDate);

            if (reportRequestInfoStatus.Equals(ReportRequestInfoStatus.ReportReady))
            {
                nLogger.Info("ReportReady, getting report");
                report = reportHandler.GetReport(reportRequestInfo.GeneratedReportId);
                if (!report.IsEmptyContent())
                {
                    reportHandler.WriteToFile(report.Content, writePath);
                }
            }
            if (report.IsEmptyContent())
            {
                nLogger.Info("getting report from disc");
                if (File.Exists(writePath))
                {
                    report.Content = File.ReadAllText(writePath);
                }
            }
            if (report.IsEmptyContent())
            {
                nLogger.Info("GetPriorReport");
                report = GetPriorReport(reportType, startDate, endDate);
                if (!report.IsEmptyContent())
                {
                    reportHandler.WriteToFile(report.Content, writePath);
                }
            }

            return(report);
        }