Пример #1
0
        public void GetParkTest()
        {
            ParkWeatherSqlDal dal = new ParkWeatherSqlDal(connectionString);

            List <Park> parkList = dal.GetParks();

            Park testPark = new Park();

            foreach (Park x in parkList)
            {
                if (x.ParkCode == parkCode)
                {
                    testPark = x;
                }
            }

            Assert.AreEqual(parkCode, testPark.ParkCode);
            Assert.AreEqual("ABCPark", testPark.Name);
            Assert.AreEqual("OH", testPark.State);
            Assert.AreEqual("0", testPark.Acreage);
            Assert.AreEqual("0", testPark.Elevation);

            Assert.AreEqual("0", testPark.MilesOfTrail);
            Assert.AreEqual("0", testPark.NumCampsites);
            Assert.AreEqual("AbcClimate", testPark.Climate);
            Assert.AreEqual("2000", testPark.YearFounded);
            Assert.AreEqual("0", testPark.AnnualVisitorCount);

            Assert.AreEqual("super inspiring quote", testPark.Quote);
            Assert.AreEqual("SuperInspiring McGee", testPark.QuoteSource);
            Assert.AreEqual("Nice park.", testPark.Description);
            Assert.AreEqual("0", testPark.EntryFee);
            Assert.AreEqual("0", testPark.NumAnimalSpecies);
        }
Пример #2
0
        public void GetParksTest()
        {
            //Arrange
            ParkWeatherSqlDal parkWeatherDal = new ParkWeatherSqlDal(connectionString);

            existingParks *= 5;

            //Act
            List <ParkWeatherModel> parks = parkWeatherDal.GetParks();

            //Assert
            Assert.AreEqual(existingParks + 5, parks.Count);
        }
Пример #3
0
        public void ForecastRecommendationsTest()
        {
            //arrange
            ParkWeatherSqlDal       applicationDal = new ParkWeatherSqlDal(connectionString);
            List <ParkWeatherModel> tempList       = applicationDal.GetParks();
            ParkWeatherModel        tempPark       = new ParkWeatherModel();

            //act
            List <ParkWeatherModel> testList = tempPark.DetailParkList("Awesome National Park", tempList);

            //assert
            Assert.AreEqual("sunny", testList[0].Forecast);
            Assert.AreEqual("dark", testList[1].Forecast);
            Assert.AreEqual("dry", testList[2].Forecast);
            Assert.AreEqual("wet", testList[3].Forecast);
            Assert.AreEqual("cloudy", testList[4].Forecast);
        }
Пример #4
0
        public void ForecastRecommendationsTest()
        {
            //arrange
            ParkWeatherSqlDal       applicationDal = new ParkWeatherSqlDal(connectionString);
            List <ParkWeatherModel> tempList       = applicationDal.GetParks();
            ParkWeatherModel        tempPark       = new ParkWeatherModel();

            //act
            List <ParkWeatherModel> testList  = tempPark.DetailParkList("Awesome National Park", tempList);
            ParkWeatherModel        testModel = testList[0];
            List <string>           result    = testModel.ForecastRecommendations(testModel);

            List <string> expected = new List <string> {
                "Pack sunblock", "Warning: exposure to frigid temperatures is dangerous", "Wear breathable layers"
            };

            //assert
            CollectionAssert.AreEqual(expected, result);
        }
Пример #5
0
        public void GetDayOfForecastTest()
        {
            //arrange
            ParkWeatherSqlDal       applicationDal = new ParkWeatherSqlDal(connectionString);
            List <ParkWeatherModel> tempList       = applicationDal.GetParks();
            ParkWeatherModel        tempPark       = new ParkWeatherModel();

            //act
            List <ParkWeatherModel> testList = tempPark.DetailParkList("Awesome National Park", tempList);

            ParkWeatherModel testModel1 = testList[0];
            ParkWeatherModel testModel2 = testList[1];
            ParkWeatherModel testModel3 = testList[2];
            ParkWeatherModel testModel4 = testList[3];
            ParkWeatherModel testModel5 = testList[4];

            string result1   = testModel1.GetDayOfForecast();
            string expected1 = DateTime.Now.DayOfWeek + ", " + DateTime.Now.ToString("MM/dd");

            string result2   = testModel2.GetDayOfForecast();
            string expected2 = DateTime.Now.AddDays(1).DayOfWeek + ", " + DateTime.Now.AddDays(1).ToString("MM/dd");

            string result3   = testModel3.GetDayOfForecast();
            string expected3 = DateTime.Now.AddDays(2).DayOfWeek + ", " + DateTime.Now.AddDays(2).ToString("MM/dd");

            string result4   = testModel4.GetDayOfForecast();
            string expected4 = DateTime.Now.AddDays(3).DayOfWeek + ", " + DateTime.Now.AddDays(3).ToString("MM/dd");

            string result5   = testModel5.GetDayOfForecast();
            string expected5 = DateTime.Now.AddDays(4).DayOfWeek + ", " + DateTime.Now.AddDays(4).ToString("MM/dd");


            //assert
            Assert.AreEqual(expected1, result1);
            Assert.AreEqual(expected2, result2);
            Assert.AreEqual(expected3, result3);
            Assert.AreEqual(expected4, result4);
            Assert.AreEqual(expected5, result5);
        }
Пример #6
0
        public void DetailParkListTest()
        {
            //arrange
            ParkWeatherSqlDal       applicationDal = new ParkWeatherSqlDal(connectionString);
            List <ParkWeatherModel> tempList       = applicationDal.GetParks();
            ParkWeatherModel        tempPark       = new ParkWeatherModel();

            //act
            List <ParkWeatherModel> testList = tempPark.DetailParkList("Awesome National Park", tempList);

            //assert
            Assert.AreEqual(5, testList.Count);
            Assert.AreEqual("Awesome National Park", testList[0].Name);
            Assert.AreEqual("Awesome National Park", testList[1].Name);
            Assert.AreEqual("Awesome National Park", testList[2].Name);
            Assert.AreEqual("Awesome National Park", testList[3].Name);
            Assert.AreEqual("Awesome National Park", testList[4].Name);
            Assert.AreEqual("1", testList[0].FiveDayForecastValue);
            Assert.AreEqual("2", testList[1].FiveDayForecastValue);
            Assert.AreEqual("3", testList[2].FiveDayForecastValue);
            Assert.AreEqual("4", testList[3].FiveDayForecastValue);
            Assert.AreEqual("5", testList[4].FiveDayForecastValue);
        }