Beispiel #1
0
        public void NewSurveyAppearsInList()
        {
            bool foundSurvey = false;

            try
            {
                using (SqlConnection conn = new SqlConnection(connectionString))
                {
                    conn.Open();
                    SqlCommand cmd = new SqlCommand("INSERT INTO park (parkCode, parkName, state, acreage, elevationInFeet, milesOfTrail, numberOfCampsites, climate, yearFounded, annualVisitorCount, inspirationalQuote, inspirationalQuoteSource, parkDescription, entryFee, numberOfAnimalSpecies) VALUES ('TEST', 'TestPark', 'Ohio', 1, 1, 1, 1, 'hot', 1999, 1, 'testquote', 'me', 'thisparkdoesntexist', 1, 1);", conn);
                    cmd.ExecuteNonQuery();
                }
            }
            catch (Exception ex)
            {
            }

            Survey survey = new Survey();

            survey.ParkCode      = "TEST";
            survey.EmailAddress  = "d@g";
            survey.State         = "OH";
            survey.ActivityLevel = "inactive";


            surveyDao.SaveSurvey(survey);

            List <Survey> testList = surveyDao.FavoritePark();

            foreach (Survey testSurvey in testList)
            {
                if (testSurvey.ParkCode == "TEST")
                {
                    foundSurvey = true;
                    break;
                }
            }

            Assert.IsTrue(foundSurvey);
        }
Beispiel #2
0
        public IActionResult FavoritePark()
        {
            List <Survey> surveys = surveyDao.FavoritePark();

            return(View(surveys)); // binds of list of surveys to fav park
        }