コード例 #1
0
        public ActionResult AddNewPlace()
        {
            Places        newPlace  = new Places(Request.Form["new-location"], Request.Form["new-dates"], Request.Form["new-picture"]);
            List <Places> allPlaces = Places.GetAll();

            return(View("List", allPlaces));
        }
コード例 #2
0
        public void GetAll_ReturnsAllInstancesOfPlaces_PlacesList()
        {
            Places        newPlace = new Places("test", "test", "test");
            List <Places> newList  = Places.GetAll();

            Assert.AreEqual(newList, Places.GetAll());
        }
コード例 #3
0
        [HttpPost("/Visited/{id}")] //Alters
        public ActionResult VisitedPlaces()
        {
            Places        newPlaces = new Places(Request.Form["location"], Request.Form["date"]);
            List <Places> allPlaces = Places.GetAll();

            // newPlaces.Save();
            return(View("/Index", allPlaces));
        }
コード例 #4
0
        public void Save_AssignsIdToObject_Id()
        {
            Places testPlace = new Places(1, "Starbucks", "123 Fake St.", "Coffee Shop", "8", "8", "97202");

            testPlace.Save();
            Places savedPlace = Places.GetAll()[0];

            int result = savedPlace.GetId();
            int testId = testPlace.GetId();

            Assert.AreEqual(testId, result);
        }
コード例 #5
0
        public void Save_SavesToDatabase_ItemList()
        {
            Places testPlace = new Places(1, "Starbucks", "123 Fake St.", "Coffee Shop", "8", "8", "97202");

            testPlace.Save();
            List <Places> result   = Places.GetAll();
            List <Places> testList = new List <Places> {
                testPlace
            };

            CollectionAssert.AreEqual(testList, result);
        }
コード例 #6
0
        public ActionResult Index()
        {
            List <Places> allPlaces = Places.GetAll();

            return(View(allPlaces));
        }
コード例 #7
0
        public void GetAll_DbStartsEmpty_0()
        {
            int result = Places.GetAll().Count;

            Assert.AreEqual(0, result);
        }