public void TestCleanup() { using (var context = new CMMIContext()) { repository = new ReviewRepository(context); repository.Remove(currentReview.ReviewId); context.SaveChanges(); userRepository = new UserRepository(context); userRepository.Remove(user.UserId); context.SaveChanges(); restaurantRepository = new RestaurantRepository(context); restaurantRepository.Remove(currentRestaurant.RestaurantId); context.SaveChanges(); } }
private void AddUserRecordsForTest() { using (var context = new CMMIContext()) { repository = new UserRepository(context); repository.Add(user); context.SaveChanges(); currentUser = repository.GetUser(user); } }
private void AddRestaurantRecordsForTest() { using (var context = new CMMIContext()) { restaurantRepository = new RestaurantRepository(context); restaurantRepository.Add(restaurantToAdd); context.SaveChanges(); currentRestaurant = restaurantRepository.GetRestaurantByProperties(restaurantToAdd); } }
private void AddReviewRecordsForTest() { using (var context = new CMMIContext()) { repository = new ReviewRepository(context); repository.Add(review); context.SaveChanges(); currentReview = repository.GetReviewsByRestaurantId(currentRestaurant.RestaurantId).FirstOrDefault(); } }
public void TestCleanup() { using (var context = new CMMIContext()) { repository = new RestaurantRepository(context); var restaurant = repository.GetRestaurantById(currentRowNumber); repository.Remove(restaurant.RestaurantId); context.SaveChanges(); } }
private void AddTestRecordToDatabase() { using (var context = new CMMIContext()) { repository = new RestaurantRepository(context); repository.Add(restaurantToAdd); context.SaveChanges(); var restaurant = repository.GetRestaurantByProperties(restaurantToAdd); currentRowNumber = restaurant.RestaurantId; } }
public int Save() { return(context.SaveChanges()); }