public void Test_RestaurantTableEmptyAtFirst() { //Arrange Act int result = Restaurant.GetAll().Count; //Assert Assert.Equal(0, result); }
public void Test1_IsRestaurantDbEmpty() { //Act int result = Restaurant.GetAll().Count; //Assert Assert.Equal(0, result); }
public void Test_Empty_DBIsEmpty() { //Arrange//Act int result = Restaurant.GetAll().Count; //Assert Assert.Equal(0, result); }
public void Test_SaveToDataBase() { Restaurant testRestaurant = new Restaurant("Pete's pies", 1); testRestaurant.Save(); int result = Restaurant.GetAll().Count; Assert.Equal(1, result); }
public void TestRestaurant_DatabaseEmptyAtFirst() { //Arrange List <Restaurant> allRestaurants = new List <Restaurant> { }; //Act List <Restaurant> testList = Restaurant.GetAll(); //Assert Assert.Equal(allRestaurants, testList); }
public void Test_Save_AssignsIdToObject() { Restaurant testRestaurant = new Restaurant("Wolf & Bears", 1, "123 example st", "555-555-5555"); testRestaurant.Save(); Restaurant savedRestaurant = Restaurant.GetAll()[0]; int result = savedRestaurant.GetId(); int testId = testRestaurant.GetId(); Assert.Equal(testId, result); }
public void Test_Save_SavesToDatabase() { Restaurant testRestaurant = new Restaurant("Wolf & Bears", 1, "123 example st", "555-555-5555"); testRestaurant.Save(); List <Restaurant> result = Restaurant.GetAll(); List <Restaurant> testList = new List <Restaurant> { testRestaurant }; Assert.Equal(testList, result); }
public void Test_Save_AssignIdToObjects() { //Arrange Restaurant testRestaurant = new Restaurant("Cactus", 2, "24 Main St.", "10AM", "11PM"); testRestaurant.Save(); Restaurant savedRestaurant = Restaurant.GetAll()[0]; int expectedResult = testRestaurant.GetId(); int actualResult = savedRestaurant.GetId(); Assert.Equal(expectedResult, actualResult); }
public void Test_Save_SavesToDatabase() { //Arrange Restaurant testRestaurant = new Restaurant("Manny's",1); //Act testRestaurant.Save(); List<Restaurant> result = Restaurant.GetAll(); List<Restaurant> testList = new List<Restaurant>{testRestaurant}; //Assert Assert.Equal(testList, result); }
public void Test_Save_SavesRestaurantToDatabase() { //arrange Restaurant newRestaurant = new Restaurant("Lucia", 3, 1); newRestaurant.Save(); //Act Restaurant savedRestaurant = Restaurant.GetAll()[0]; //assert Assert.Equal(newRestaurant, savedRestaurant); }
public void Test_SavesRestaurantToDatabase() { //Arrange Restaurant testRestaurant = new Restaurant("Chipotle", 1, new DateTime(1984, 9, 3), "In da hood"); testRestaurant.Save(); //Act List <Restaurant> restaurantList = Restaurant.GetAll(); List <Restaurant> tempList = new List <Restaurant> { testRestaurant }; Assert.Equal(restaurantList, tempList); }
public void Test_Save_SavesToDataBase() { //Arrange Restaurant testRestaurant = new Restaurant("French Restaurant", 1, "24 Main St.", "10AM", "11PM"); //Act testRestaurant.Save(); List <Restaurant> actualResult = Restaurant.GetAll(); List <Restaurant> expectedResult = new List <Restaurant> { testRestaurant }; //Assert Assert.Equal(expectedResult, actualResult); }
public void Test_Save_AssignsIdToObject() { //Arrange Restaurant testRestaurant = new Restaurant("Mow the lawn",1); //Act testRestaurant.Save(); Restaurant savedRestaurant = Restaurant.GetAll()[0]; int result = savedRestaurant.GetId(); int testId = testRestaurant.GetId(); //Assert Assert.Equal(testId, result); }
public void Test4_SaveIdToDb() { //Arrange Restaurant testRestaurant = new Restaurant("thai"); testRestaurant.Save(); //Act Restaurant savedRestaurant = Restaurant.GetAll()[0]; int result = savedRestaurant.GetId(); int testRestaurantId = testRestaurant.GetId(); //Assert Assert.Equal(testRestaurantId, result); }
public void Test3_SaveWork() { //Arrange Restaurant testRestaurant = new Restaurant("thai"); testRestaurant.Save(); //Act List <Restaurant> result = Restaurant.GetAll(); List <Restaurant> testList = new List <Restaurant> { testRestaurant }; //Assert Assert.Equal(testList, result); }
public void Test_DeleteRestaurant_DeleteRestaurantFromDatabase() { //Arrange Restaurant testRestaurant = new Restaurant("Le Fromage", 1, "24 Main St.", "10AM", "11PM"); //Act testRestaurant.Save(); testRestaurant.DeleteRestaurant(); //Assert List <Restaurant> expectedResult = new List <Restaurant> { }; List <Restaurant> actualResult = Restaurant.GetAll(); Assert.Equal(expectedResult, actualResult); }
public void Test_Delete_DeletesRestaurantFromDatabase() { //Arrange Restaurant testRestaurant1 = new Restaurant("Taste of India", 1, "123 example st", "555-555-5555"); testRestaurant1.Save(); Restaurant testRestaurant2 = new Restaurant("Olive Garden", 2, "123 example st", "555-555-5555"); testRestaurant2.Save(); //Act testRestaurant1.Delete(); List <Restaurant> resultRestaurants = Restaurant.GetAll(); List <Restaurant> testRestaurantList = new List <Restaurant> { testRestaurant2 }; //Assert Assert.Equal(testRestaurantList, resultRestaurants); }
public void Test_Delete_DeletesCuisineFromDatabase() { //Arrange string type1 = "french"; Cuisine testCuisine1 = new Cuisine(type1); testCuisine1.Save(); string type2 = "Thai"; Cuisine testCuisine2 = new Cuisine(type2); testCuisine2.Save(); Restaurant testRestaurant1 = new Restaurant("jims place", testCuisine1.GetId()); testRestaurant1.Save(); Restaurant testRestaurant2 = new Restaurant("pig ynakers ", testCuisine2.GetId()); testRestaurant2.Save(); //Act testCuisine1.Delete(); List <Cuisine> resultCuisines = Cuisine.GetAll(); List <Cuisine> testCuisineList = new List <Cuisine> { testCuisine2 }; List <Restaurant> resultRestaurants = Restaurant.GetAll(); List <Restaurant> testRestaurantList = new List <Restaurant> { testRestaurant2 }; //Assert Assert.Equal(testCuisineList, resultCuisines); Assert.Equal(testRestaurantList, resultRestaurants); }
public void Test_Delete_DeletesCuisineFromDatabase() { //Arrange string name1 = "Indian"; Cuisine testCuisine1 = new Cuisine(name1); testCuisine1.Save(); string name2 = "Italian"; Cuisine testCuisine2 = new Cuisine(name2); testCuisine2.Save(); Restaurant testRestaurant1 = new Restaurant("Taste of India", testCuisine1.GetId(), "123 example st", "555-555-5555"); testRestaurant1.Save(); Restaurant testRestaurant2 = new Restaurant("Olive Garden", testCuisine2.GetId(), "123 example st", "555-555-5555"); testRestaurant2.Save(); //Act testCuisine1.Delete(); List <Cuisine> resultCuisine = Cuisine.GetAll(); List <Cuisine> testCuisineList = new List <Cuisine> { testCuisine2 }; List <Restaurant> resultRestaurants = Restaurant.GetAll(); List <Restaurant> testRestaurantList = new List <Restaurant> { testRestaurant2 }; //Assert Assert.Equal(testCuisineList, resultCuisine); Assert.Equal(testRestaurantList, resultRestaurants); }
public HomeModule() { Get["/"] = _ => { List <Cuisine> AllCuisine = Cuisine.GetAll(); return(View["index.cshtml", AllCuisine]); }; Get["/restaurants"] = _ => { List <Restaurant> AllResturants = Restaurant.GetAll(); return(View["restaurants.cshtml", AllResturants]); }; Get["/cuisines"] = _ => { List <Cuisine> AllCuisine = Cuisine.GetAll(); return(View["cuisines.cshtml", AllCuisine]); }; Get["/cuisines/new"] = _ => { return(View["cuisines_form.cshtml"]); }; Post["/cuisines/new"] = _ => { Cuisine newCuisine = new Cuisine(Request.Form["cuisine-type"]); newCuisine.Save(); return(View["success.cshtml"]); }; Get["/restaurants/new"] = _ => { List <Cuisine> AllCuisine = Cuisine.GetAll(); return(View["restaurants_form.cshtml", AllCuisine]); }; Post["/restaurants/new"] = _ => { Restaurant newRestaurant = new Restaurant(Request.Form["restaurant-name"], Request.Form["cuisine-id"]); newRestaurant.Save(); return(View["success.cshtml"]); }; Post["/restaurants/delete"] = _ => { Restaurant.DeleteAll(); return(View["cleared.cshtml"]); }; Get["/cuisines/{id}"] = parameters => { Dictionary <string, object> model = new Dictionary <string, object>(); var SelectedCuisine = Cuisine.Find(parameters.id); var CuisineRestaurants = SelectedCuisine.GetRestaurants(); model.Add("cuisine", SelectedCuisine); model.Add("restaurants", CuisineRestaurants); return(View["cuisine.cshtml", model]); }; Get["/cuisine/edit/{id}"] = parameters => { Dictionary <string, object> model = new Dictionary <string, object>(); Cuisine SelectedCuisine = Cuisine.Find(parameters.id); List <Restaurant> CuisineRestaurants = SelectedCuisine.GetRestaurants(); model.Add("cuisine", SelectedCuisine); model.Add("restaurants", CuisineRestaurants); return(View["cuisine_edit.cshtml", model]); }; Patch["/cuisine/edit/{id}"] = parameters => { Cuisine SelectedCuisine = Cuisine.Find(parameters.id); SelectedCuisine.Update(Request.Form["cuisine-type"]); return(View["success.cshtml"]); }; Get["/cuisine/delete/{id}"] = parameters => { Dictionary <string, object> model = new Dictionary <string, object>(); Cuisine SelectedCuisine = Cuisine.Find(parameters.id); List <Restaurant> CuisineRestaurants = SelectedCuisine.GetRestaurants(); model.Add("cuisine", SelectedCuisine); model.Add("restaurants", CuisineRestaurants); return(View["cuisine_delete.cshtml", model]); }; Delete["/cuisine/delete/{id}"] = parameters => { Cuisine SelectedCuisine = Cuisine.Find(parameters.id); SelectedCuisine.Delete(); return(View["success.cshtml"]); }; }
public void Test_EmptyAtFirst() { int result = Restaurant.GetAll().Count; Assert.Equal(0, result); }
public HomeModule() { Get["/"] = _ => { return(View["index.cshtml"]); }; Get["/Cuisine"] = _ => { return(View["cuisine.cshtml", Cuisine.GetAll()]); }; Post["/Cuisine"] = _ => { Cuisine newCuisine = new Cuisine(Request.Form["name"]); newCuisine.Save(); return(View["cuisine.cshtml", Cuisine.GetAll()]); }; Get["/Cuisine/{id}"] = parameters => { Cuisine newCuisine = Cuisine.Find(parameters.id); List <Restaurant> restaurantList = Restaurant.FindByCuisineId(newCuisine.GetId()); Dictionary <string, object> myDictionary = new Dictionary <string, object> { }; myDictionary.Add("cuisine", newCuisine); myDictionary.Add("restaurants", restaurantList); return(View["cuisineView.cshtml", myDictionary]); }; Post["/Cuisine/Update/{id}"] = parameters => { Cuisine newCuisine = Cuisine.Find(parameters.id); newCuisine.Update(Request.Form["name"]); return(View["cuisine.cshtml", Cuisine.GetAll()]); }; Get["/Cuisine/Delete/{id}"] = parameters => { Cuisine newCuisine = Cuisine.Find(parameters.id); newCuisine.Delete(); return(View["cuisine.cshtml", Cuisine.GetAll()]); }; Get["/Cuisine/Create"] = _ => { return(View["cuisineCreate.cshtml"]); }; Get["/Cuisine/Delete"] = _ => { Cuisine.DeleteAll(); return(View["cuisine.cshtml", "delete"]); }; Get["/Restaurant"] = _ => { return(View["restaurant.cshtml", Restaurant.GetAll()]); }; Post["/Restaurant"] = _ => { DateTime newDateTime = Convert.ToDateTime((string)Request.Form["date"]); Restaurant newRestaurant = new Restaurant(Request.Form["name"], Request.Form["cuisine"], newDateTime, Request.Form["location"]); newRestaurant.Save(); return(View["restaurant.cshtml", Restaurant.GetAll()]); }; Get["/Restaurant/{id}"] = parameters => { List <Cuisine> cuisineList = Cuisine.GetAll(); Restaurant newRestaurant = Restaurant.Find(parameters.id); Dictionary <string, object> myDictionary = new Dictionary <string, object> { }; myDictionary.Add("cuisine", cuisineList); myDictionary.Add("restaurant", newRestaurant); return(View["restaurantView.cshtml", myDictionary]); }; Post["/Restaurant/Update/{id}"] = parameters => { Restaurant newRestaurant = Restaurant.Find(parameters.id); DateTime newDateTime = Convert.ToDateTime((string)Request.Form["date"]); newRestaurant.Update(Request.Form["name"], Request.Form["cuisine"], newDateTime, Request.Form["location"]); return(View["restaurant.cshtml", Restaurant.GetAll()]); }; Get["/Restaurant/Delete/{id}"] = parameters => { Restaurant newRestaurant = Restaurant.Find(parameters.id); newRestaurant.Delete(); return(View["restaurant.cshtml", Restaurant.GetAll()]); }; Get["/Restaurant/Create"] = _ => { List <Cuisine> newCuisine = Cuisine.GetAll(); return(View["restaurantCreate.cshtml", newCuisine]); }; Get["/Restaurant/Delete"] = _ => { Restaurant.DeleteAll(); return(View["restaurant.cshtml", "delete"]); }; }