Ejemplo n.º 1
0
        public void GetSurveys()
        {
            // Arrange
            // initializes a new SurveyDAL with the connectionString parameter
            SurveyDAL surveyDal = new SurveyDAL(connectionString);

            // Act
            // runs the GetSurveys method to get a FavoriteParks object (which is a list of surveys
            // grouped by # of surveys for each park) from the survey_result table
            List <FavoriteParks> surveys = surveyDal.GetSurveys();

            // Assert
            // Checks to make sure the FavoritePark object is no longer empty
            Assert.IsTrue(surveys.Count > 0);

            // Assert
            // Checks to make sure the last FavoritePark object is for the test park which
            // we made in the Initialize method above; the GetSurveys method sorts by the
            // count of surveys (descending), then alphabetically by park name (ascending), so in this case the
            // test park would only show up once, and alphabetically would be last, so it should be the last
            // entry in the list
            Assert.AreEqual("ZZZ", surveys[surveys.Count - 1].ParkCode);
        }