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();
     }
 }
示例#2
0
 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;
     }
 }
示例#7
0
 public int Save()
 {
     return(context.SaveChanges());
 }