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)); }
public void GetAll_ReturnsAllInstancesOfPlaces_PlacesList() { Places newPlace = new Places("test", "test", "test"); List <Places> newList = Places.GetAll(); Assert.AreEqual(newList, Places.GetAll()); }
[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)); }
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); }
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); }
public ActionResult Index() { List <Places> allPlaces = Places.GetAll(); return(View(allPlaces)); }
public void GetAll_DbStartsEmpty_0() { int result = Places.GetAll().Count; Assert.AreEqual(0, result); }