コード例 #1
0
        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);
        }
コード例 #2
0
        public void TestAddCovidCaseThrowsNullException()
        {
            var covidLocationData = new CovidLocationData("GA");

            Assert.ThrowsException <ArgumentNullException>(() =>
                                                           covidLocationData.AddCovidCase(null));
        }
コード例 #3
0
        public void TestInvalidUpperBound()
        {
            var covidLocationData = new CovidLocationData("GA");

            Assert.ThrowsException <ArgumentNullException>(() =>
                                                           covidLocationData.GetEventsFromMonth(13));
        }
コード例 #4
0
        public void TestZeroEventsFromMonth()
        {
            var covidLocationData = new CovidLocationData("GA");

            const int expected = 0;
            var       result   = covidLocationData.GetEventsFromMonth(1).Count;

            Assert.AreEqual(expected, result);
        }
コード例 #5
0
        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);
        }
コード例 #6
0
        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);
        }
コード例 #8
0
        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);
        }
コード例 #9
0
        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);
        }
コード例 #10
0
        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);
        }
コード例 #11
0
        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);
        }
コード例 #12
0
        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);
        }
コード例 #13
0
        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);
        }
コード例 #14
0
 /// <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));
 }
コード例 #15
0
        public void TestGetLowestNumberOfTotalTestsReturnNull()
        {
            CovidLocationData covidLocationData = new CovidLocationData("GA");

            Assert.IsNull(covidLocationData.GetLowestNumberOfTotalTests(covidLocationData.CovidCases));
        }
コード例 #16
0
        public void TestGetHighestDeathCaseReturnNull()
        {
            var covidLocationData = new CovidLocationData("GA");

            Assert.IsNull(covidLocationData.GetHighestDeathsEvent());
        }
コード例 #17
0
        public void TestGetEarliestPositiveCaseReturnNull()
        {
            var covidLocationData = new CovidLocationData("GA");

            Assert.IsNull(covidLocationData.GetEarliestPositiveCase());
        }
コード例 #18
0
        public void TestGetHighestHospitalizationReturnNull()
        {
            var covidLocationData = new CovidLocationData("GA");

            Assert.IsNull(covidLocationData.GetHighestHospitalization());
        }
        public void TestNull()
        {
            CovidLocationData covidLocationData = new CovidLocationData("GA");

            Assert.IsNull(covidLocationData.GetHighestNumberOfNegativeIncreases());
        }