コード例 #1
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);
        }
コード例 #2
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);
        }
コード例 #3
0
        public ActionResult EnterResults()
        {
            string name     = Request.Form["name"];
            string address  = Request.Form["address"];
            string category = Request.Form["category"];
            string opening  = Request.Form["opening"];
            string closing  = Request.Form["closing"];
            string zipCode  = Request.Form["zipCode"];

            Places newPlace = new Places(0, name, address, category, opening, closing, zipCode);

            newPlace.Save();
            return(View("EnterResults", newPlace));
        }