public void DeleteRestaurant_GivenRestaurant_CallsRepositoryMethod() { var restaurant = new Restaurant(); _restaurantService.DeleteRestaurant(restaurant); _mockRepository.Verify(x => x.Delete(It.IsAny <Restaurant>()), Times.AtLeastOnce); }
public void CreateRestaurantTest() { Adress a = new Adress(12, "rue de la chevre", 38500, "voiron"); Restaurant r = new Restaurant("le chevre", "0788888888", "bonjour je suis la description", "*****@*****.**", a); _restaurantService.AddRestaurant(r); var restId = r.ID; //this is put after because the GUID seams to be only created when the object is inserted into the database var restaurant = _restaurantService.GetAllRestaurant().Find(m => m.ID == restId); Assert.IsTrue(restaurant.Name == r.Name); Assert.IsTrue(restaurant.Phone == r.Phone); Assert.IsTrue(restaurant.Description == r.Description); Assert.IsTrue(restaurant.Email == r.Email); _restaurantService.DeleteRestaurant(restaurant); //deletes it to clean the database }
public void DeleteRestaurant_GivenRestuarnt_DeletesRestuarnt() { var restaurant = new Restaurant { RestaurantId = Guid.NewGuid(), RestaurantPublicId = Guid.NewGuid() }; _testContext.Restaurants.Add(restaurant); _testContext.SaveChanges(); _restaurantService.DeleteRestaurant(restaurant); var restaurants = _restaurantService.Get(); Assert.IsFalse(restaurants.Contains(restaurant)); }
public void TearDown() { _restaurantService.DeleteRestaurant(_mainRestaurant); //cleans the test by deleting the restaurant when finishes }
public bool Delete(string id) { return(restaurant.DeleteRestaurant(id)); }