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; }
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()); }
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); }
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); }