/// <Summary>Gets the highest percentage of positive tests with date.</Summary> /// <returns>A formatted string with the highest percentage of positive test and date</returns> public string GetHighestPercentageOfTestsPerDayWithDate() { string highestPercentage; var date = string.Empty; try { var highestPercentageRecord = this.covidStatistics.FindRecordWithHighestPercentageOfPositiveTests(); var positivePercentage = CovidDataStatistics.FindPositivePercentageForRecord(highestPercentageRecord); highestPercentage = Format.FormatNumericValueAsPercentage(positivePercentage); date = highestPercentageRecord.Date.ToString(Assets.DateStringFormatted); } catch (Exception) { highestPercentage = Assets.NoPositiveData; } return(CovidDataLines.GetCovidLineForValueAndDate(Assets.HighestPercentageOfPositiveCasesLabel, highestPercentage, date)); }
public void TestFiftyPercentPositive() { var result = CovidDataStatistics.FindPositivePercentageForRecord(this.record3); Assert.AreEqual(0.5, result, Delta); }
public void TestOneHundredPercentPositive() { var result = CovidDataStatistics.FindPositivePercentageForRecord(this.record4); Assert.AreEqual(1.0, result, Delta); }
public void TestZeroPositives() { var result = CovidDataStatistics.FindPositivePercentageForRecord(this.record1); Assert.AreEqual(double.NaN, result); }