Ejemplo n.º 1
0
        public void GetParkSelectListTest() //List<SelectListItem> GetParkSelectList()
        {
            //Arrange
            IParkDAL parkSqlDAL = new ParkSqlDAL(connectionString);

            //ACT
            List <SelectListItem> parkSelectList = parkSqlDAL.GetParkSelectList();

            //Assert
            Assert.IsNotNull(parkSelectList, "parkSelectList is empty!");
            Assert.AreEqual(parkCount, parkSelectList.Count, $"Expected a count of {parkCount} for parkSelectList");
        }
        public void GetParkSelectList()
        {
            ParkSqlDAL parkSqlDAL = new ParkSqlDAL(connectionString);

            List <SelectListItem> selectListItems       = parkSqlDAL.GetParkSelectList();
            SelectListItem        newParkSelectListItem = new SelectListItem()
            {
                Text = "Test Park National Park", Value = "AAA"
            };
            int index = -1;

            for (int i = 0; i < selectListItems.Count; i++)
            {
                if (selectListItems[i].Text == newParkSelectListItem.Text && selectListItems[i].Value == newParkSelectListItem.Value)
                {
                    index = i;
                }
            }

            Assert.IsNotNull(selectListItems);
            Assert.AreEqual(newParkSelectListItem.Text, selectListItems[index].Text);
            Assert.AreEqual(newParkSelectListItem.Value, selectListItems[index].Value);
        }