Exemplo n.º 1
0
        /// <Summary>Gets the Overall Positivity Rate.</Summary>
        /// <returns>A formatted string with the Overall Positivity Rate.</returns>
        public string GetOverallPositivityRateSinceFirstPositiveTest()
        {
            string positivityRate;

            try
            {
                var overallPositivityRate = this.covidStatistics.FindOverallPositivityRateSinceFirstPositiveTest();
                positivityRate = Format.FormatNumericValueAsPercentage(overallPositivityRate);
            }
            catch (Exception)
            {
                positivityRate = Assets.NoPositiveData;
            }

            return(CovidDataLines.GetCovidLineForValue(Assets.OverallPositivityRateLabel, positivityRate));
        }
Exemplo n.º 2
0
        /// <Summary>Gets the average positive tests.</Summary>
        /// <returns>A formatted string with the average positive  test.</returns>
        public string GetAveragePositiveTestsSinceFirstPositiveTest()
        {
            string average;

            try
            {
                var averagePositiveTest = this.covidStatistics.FindAveragePositiveTestsSinceFirstPositiveTest();
                average = Format.FormatAveragesWithTwoDecimalPlaces(averagePositiveTest);
            }
            catch (Exception)
            {
                average = Assets.NoPositiveData;
            }

            return(CovidDataLines.GetCovidLineForValue(Assets.AveragePositiveTestsLabel, average));
        }
        private string getAverageTotalTests()
        {
            string totalTestsAverageFormatted;

            try
            {
                var firstPositiveTestDate = this.getDateOfFirstPositiveTest();
                var totalTestsAverage     =
                    this.covidStatistics.FindAverageTotalTestsSinceSpecifiedDate(firstPositiveTestDate);
                totalTestsAverageFormatted = Format.FormatAveragesWithTwoDecimalPlaces(totalTestsAverage);
            }
            catch (Exception)
            {
                totalTestsAverageFormatted = Assets.NoPositiveData;
            }

            return(CovidDataLines.GetCovidLineForValue(Assets.AverageTotalTestsLabel, totalTestsAverageFormatted));
        }
        private string getAveragePositiveTests()
        {
            string positiveAverageFormatted;

            try
            {
                var dateSinceFirstPositiveTests = this.getDateOfFirstPositiveTest();
                var positiveAverage             =
                    this.covidStatistics.FindAveragePositiveTestsSinceSpecifiedDate(dateSinceFirstPositiveTests);
                positiveAverageFormatted = Format.FormatAveragesWithTwoDecimalPlaces(positiveAverage);
            }
            catch (Exception)
            {
                positiveAverageFormatted = Assets.NoPositiveData;
            }

            return(CovidDataLines.GetCovidLineForValue(Assets.AveragePositiveTestsLabel, positiveAverageFormatted));
        }