示例#1
0
        public void SaveNewSurveyTest() //void SaveNewSurvey(Survey survey)
        {
            //Arrange
            ISurveyDAL surveySqlDAL          = new SurveySqlDAL(connectionString);
            Dictionary <string, int> surveys = surveySqlDAL.GetFavoriteParkBySurveyCount();
            Survey survey = new Survey()
            {
                ParkCode      = "YNP2",
                Email         = "*****@*****.**",
                State         = "Ohio",
                ActivityLevel = "Inactive"
            };
            int before;

            if (surveys.ContainsKey("YNP2"))
            {
                before = surveys["YNP2"];
            }
            else
            {
                before = 0;
            }

            //ACT
            surveySqlDAL.SaveNewSurvey(survey);

            //check that the added survey increased the # of votes for yosemite by 1.
            Dictionary <string, int> surveysNew = surveySqlDAL.GetFavoriteParkBySurveyCount();
            int after = surveysNew["YNP2"];

            //Assert
            Assert.IsNotNull(surveysNew, "Yosemite should have at least 1 vote(survey).");
            Assert.AreEqual((before + 1), after, $"Yosemite should have had {before} surveys before the add and {after} surveys after the add.");
        }
示例#2
0
        public void SaveNewSurveyTest()
        {
            SurveySqlDAL surveyDAL  = new SurveySqlDAL(connectionString);
            Survey       testSurvey = new Survey()
            {
                SurveyId = surveyId,
            };

            Assert.AreEqual(true, surveyDAL.SaveNewSurvey(testSurvey));
        }