public Engine(
     ReportRetriever dataGrabber,
     Formatter formatter,
     ILoadMeteorology writer,
     TransformTemporalMeasurement transformer,
     CommandLineParser commandLineParser)
 {
     this.grabber           = dataGrabber;
     this.formatter         = formatter;
     this.writer            = writer;
     this.transformer       = transformer;
     this.commandLineParser = commandLineParser;
 }
Example #2
0
        public async Task InternalErrorFromReportApi()
        {
            var reportConfig = new ReportConfig
            {
                Url     = "https://covid-19-statistics.p.rapidapi.com/reports",
                ApiKey  = "48c6ea5926msh35c92edffc8d551p130b01jsnb7aafad496a2",
                ApiHost = "covid-19-statistics.p.rapidapi.com",
            };

            var clientFactory = HttpClientBuilder.ReportClientFactory(ResponseBuilder.BuildInternalErrorResponse(), HttpStatusCode.InternalServerError);


            IReportRetriever reportRetriever = new ReportRetriever(reportConfig, clientFactory);

            await Assert.ThrowsAsync <HttpRequestException>(() => reportRetriever.RetrieveAllData());
        }
Example #3
0
        public async Task ExpectedValuesFromReportApi()
        {
            var reportConfig = new ReportConfig
            {
                Url     = "https://covid-19-statistics.p.rapidapi.com/reports",
                ApiKey  = "48c6ea5926msh35c92edffc8d551p130b01jsnb7aafad496a2",
                ApiHost = "covid-19-statistics.p.rapidapi.com",
            };
            var clientFactory = HttpClientBuilder.ReportClientFactory(ResponseBuilder.BuildOkResponse());


            IReportRetriever reportRetriever = new ReportRetriever(reportConfig, clientFactory);
            var response = await reportRetriever.RetrieveAllData();


            Assert.Equal("AFG", response.data[0].region.iso);
            Assert.Equal("ATG", response.data[1].region.iso);
        }
Example #4
0
        public async Task ExpectedValuesFromReport()
        {
            var reportConfig = new ReportConfig
            {
                Url     = "https://covid-19-statistics.p.rapidapi.com/reports",
                ApiKey  = "48c6ea5926msh35c92edffc8d551p130b01jsnb7aafad496a2",
                ApiHost = "covid-19-statistics.p.rapidapi.com",
            };
            var clientFactory = HttpClientBuilder.ReportClientFactory(ResponseBuilder.BuildOkResponse());
            IReportRetriever reportRetriever = new ReportRetriever(reportConfig, clientFactory);


            IReportBuilder regionReportBuilder = new ReportBuilder(reportRetriever);
            var            report = await regionReportBuilder.GetReportData();

            Assert.Equal(119528, report[0].Cases);
            Assert.Equal(56044, report[1].Cases);
            Assert.Equal(1008, report[2].Cases);
        }