public void TestPositiveTestAboveFive() { const int testCount = 5; CovidLocationData covidLocationData = new CovidLocationData("GA"); covidLocationData.AddCovidCase(new CovidCase("GA", new DateTime(2015, 2, 15)) { PositiveIncrease = 0 }); covidLocationData.AddCovidCase(new CovidCase("GA", new DateTime(2016, 2, 15)) { PositiveIncrease = 6 }); covidLocationData.AddCovidCase(new CovidCase("GA", new DateTime(2017, 2, 15)) { PositiveIncrease = 10 }); const int expected = 2; int result = covidLocationData.GetNumberOfDaysWherePositiveTestsAreAbove(testCount); Assert.AreEqual(expected, result); }
public void TestAddCovidCaseThrowsNullException() { var covidLocationData = new CovidLocationData("GA"); Assert.ThrowsException <ArgumentNullException>(() => covidLocationData.AddCovidCase(null)); }
public void TestInvalidUpperBound() { var covidLocationData = new CovidLocationData("GA"); Assert.ThrowsException <ArgumentNullException>(() => covidLocationData.GetEventsFromMonth(13)); }
public void TestZeroEventsFromMonth() { var covidLocationData = new CovidLocationData("GA"); const int expected = 0; var result = covidLocationData.GetEventsFromMonth(1).Count; Assert.AreEqual(expected, result); }
public void TestAddCovidCase() { var covidLocationData = new CovidLocationData("GA"); covidLocationData.AddCovidCase(new CovidCase("GA", new DateTime(2015, 1, 15))); const int expected = 1; var result = covidLocationData.CovidCases.Count; Assert.AreEqual(expected, result); }
private async Task extractData() { if (this.CurrentFile != null) { csvReader.CsvFile = this.CurrentFile; IList <CovidCase> covidCases = await csvReader.Parse(); this.covidCollection.AddAllCovidCases(covidCases); this.covidLocationData = this.covidCollection.GetLocationData(LocationOfInterest); } }
public void TestHighestWithOnlyOneCase() { CovidLocationData covidLocationData = new CovidLocationData("GA"); covidLocationData.AddCovidCase(new CovidCase("GA", new DateTime(2015, 2, 15)) { NegativeIncrease = 0 }); const int expected = 0; var result = covidLocationData.GetHighestNumberOfNegativeIncreases().NegativeIncrease; Assert.AreEqual(expected, result); }
public void TestOneEventsFromMonth() { var covidLocationData = new CovidLocationData("GA"); covidLocationData.AddCovidCase(new CovidCase("GA", new DateTime(2015, 1, 15)) { HospitalizedCurrently = 0 }); covidLocationData.AddCovidCase(new CovidCase("GA", new DateTime(2016, 2, 15)) { HospitalizedCurrently = 5 }); const int expected = 1; var result = covidLocationData.GetEventsFromMonth(1).Count; Assert.AreEqual(expected, result); }
public void TestGetHighestDeathCase() { var covidLocationData = new CovidLocationData("GA"); covidLocationData.AddCovidCase(new CovidCase("GA", new DateTime(2015, 2, 15)) { DeathIncrease = 50 }); covidLocationData.AddCovidCase(new CovidCase("GA", new DateTime(2016, 2, 15)) { DeathIncrease = 125 }); const int expected = 125; var result = covidLocationData.GetHighestDeathsEvent().DeathIncrease; Assert.AreEqual(expected, result); }
public void TestGetHighestHospitalizationCase() { var covidLocationData = new CovidLocationData("GA"); covidLocationData.AddCovidCase(new CovidCase("GA", new DateTime(2015, 2, 15)) { HospitalizedIncrease = 50 }); covidLocationData.AddCovidCase(new CovidCase("GA", new DateTime(2016, 2, 15)) { HospitalizedIncrease = 125 }); const int expected = 125; var result = covidLocationData.GetHighestHospitalization().HospitalizedIncrease; Assert.AreEqual(expected, result); }
public void TestGetLowestNumberOfTotalTests() { CovidLocationData covidLocationData = new CovidLocationData("GA"); covidLocationData.AddCovidCase(new CovidCase("GA", new DateTime(2015, 1, 15)) { PositiveIncrease = 50, NegativeIncrease = 50 }); covidLocationData.AddCovidCase(new CovidCase("GA", new DateTime(2016, 2, 15)) { PositiveIncrease = 125, NegativeIncrease = 75 }); const int expected = 100; var result = covidLocationData.GetLowestNumberOfTotalTests(covidLocationData.CovidCases).TotalTestCount; Assert.AreEqual(expected, result); }
public void TestGetEarliestPositiveCase() { var covidLocationData = new CovidLocationData("GA"); covidLocationData.AddCovidCase(new CovidCase("GA", new DateTime(2016, 2, 15)) { PositiveIncrease = 125 }); covidLocationData.AddCovidCase(new CovidCase("GA", new DateTime(2016, 2, 10)) { PositiveIncrease = 125 }); covidLocationData.AddCovidCase(new CovidCase("GA", new DateTime(2016, 2, 12)) { PositiveIncrease = 125 }); const string expected = "2/10/2016"; var covidCase = covidLocationData.GetEarliestPositiveCase(); var result = covidCase.Date.ToShortDateString(); Assert.AreEqual(expected, result, true); }
public void TestMinIsTen() { var covidLocationData = new CovidLocationData("GA"); covidLocationData.AddCovidCase(new CovidCase("GA", new DateTime(2015, 2, 15)) { HospitalizedCurrently = 10 }); covidLocationData.AddCovidCase(new CovidCase("GA", new DateTime(2016, 2, 15)) { HospitalizedCurrently = 20 }); covidLocationData.AddCovidCase(new CovidCase("GA", new DateTime(2017, 2, 15)) { HospitalizedCurrently = 25 }); const int expected = 10; var result = covidLocationData.GetCurrentHospitalizationsMinimum(covidLocationData.CovidCases); Assert.AreEqual(expected, result); }
/// <summary> /// Initializes a new instance of the <see cref="SummaryStatisticsFormatter"/> class. /// </summary> /// <param name="stateData">The state data.</param> /// <exception cref="NullReferenceException">stateData</exception> public SummaryStatisticsFormatter(CovidLocationData stateData) { this.location = stateData ?? throw new NullReferenceException(nameof(stateData)); }
public void TestGetLowestNumberOfTotalTestsReturnNull() { CovidLocationData covidLocationData = new CovidLocationData("GA"); Assert.IsNull(covidLocationData.GetLowestNumberOfTotalTests(covidLocationData.CovidCases)); }
public void TestGetHighestDeathCaseReturnNull() { var covidLocationData = new CovidLocationData("GA"); Assert.IsNull(covidLocationData.GetHighestDeathsEvent()); }
public void TestGetEarliestPositiveCaseReturnNull() { var covidLocationData = new CovidLocationData("GA"); Assert.IsNull(covidLocationData.GetEarliestPositiveCase()); }
public void TestGetHighestHospitalizationReturnNull() { var covidLocationData = new CovidLocationData("GA"); Assert.IsNull(covidLocationData.GetHighestHospitalization()); }
public void TestNull() { CovidLocationData covidLocationData = new CovidLocationData("GA"); Assert.IsNull(covidLocationData.GetHighestNumberOfNegativeIncreases()); }