示例#1
0
        // Gets a single parks information
        private Park GetPark(int parkId)
        {
            IParkDAL parkdal = new ParkSqlDAL(DatabaseConnectionString.DatabaseString);
            Park     park    = parkdal.GetPark(parkId);

            return(park);
        }
        public void GetParkTest()
        {
            ParkSqlDAL parkSqlDAL = new ParkSqlDAL(connectionString);

            Park park = parkSqlDAL.GetPark("AAA");

            Assert.AreEqual("Test Park National Park", park.Name);
            Assert.IsNotNull(park);
        }
示例#3
0
        public ActionResult Detail(string id)
        {
            ParkSqlDAL dal       = new ParkSqlDAL(connectionString);
            Parks      parkModel = dal.GetPark(id);

            ViewBag.weather = id;

            return(View("Detail", parkModel));
        }
示例#4
0
        public void GetParkTest_name()
        {
            Parks result = new Parks();

            ParkSqlDAL parks = new ParkSqlDAL(connectionString);

            result = parks.GetPark("ENP");

            Assert.AreEqual("Everglades National Park", result.Name);
        }
示例#5
0
        public void GetParkTest_climate()
        {
            Parks result = new Parks();

            ParkSqlDAL parks = new ParkSqlDAL(connectionString);

            result = parks.GetPark("ENP");

            Assert.AreEqual("Tropical", result.Climate);
        }
示例#6
0
        public void GetPark_GetsPark()
        {
            // Arrange
            ParkSqlDAL PSDal = new ParkSqlDAL(ConnectionString);

            // Act
            Park park = PSDal.GetPark(1);

            // Assert
            Assert.AreEqual("Testpark", park.Name);
        }
示例#7
0
        public void GetParkTest()
        {
            //Arrange
            ParkSqlDAL dal = new ParkSqlDAL(connectionString);

            //Act
            List <Park> listOfParks = dal.GetPark();

            //Assert
            Assert.AreEqual(1, listOfParks.Count());
            Assert.AreEqual("Test Park", listOfParks[0].name);
        }
示例#8
0
        public IActionResult Detail(string id)
        {
            var park = pdal.GetPark(id);
            //Get weather results for said park
            var weather = wdal.GetWeatherForPark(id);
            var model   = new ParkDetailModel()
            {
                Park        = park,
                ParkWeather = weather
            };

            return(View(model));
        }
示例#9
0
        public void GetParkTest() //Park GetPark(string parkCode)
        {
            //Arrange
            IParkDAL parkSqlDAL = new ParkSqlDAL(connectionString);


            //ACT
            Park park = parkSqlDAL.GetPark("YNP2");

            //Assert
            Assert.IsNotNull(park, "Yosemite was not found");
            Assert.AreEqual("California", park.State, "Yosemite should be in California");
            Assert.AreEqual(1890, park.YearFounded, "Incorrect YearFounded associated with Yosemite. Should be 1890");
        }
示例#10
0
        private void GetPark()
        {
            ParkSqlDAL  dal   = new ParkSqlDAL(DatabaseConnection);
            List <Park> parks = dal.GetPark();

            if (parks.Count > 0)
            {
                parks.ForEach(p =>
                {
                    Console.WriteLine(p);
                });
            }
            else
            {
                Console.WriteLine("****NO RESULTS****");
            }
        }