public void user_can_delete_categories_to_observe() { var category = _categoryRepository.FindAll().FirstOrDefault(); var favouriteLevel = _categoryFavouriteLevelRepository.FindAll().FirstOrDefault(); var userCategory = new UserCategory { User = DatabaseHelper.UserTest2A, Category = category, CategoryFavouriteLevel = favouriteLevel }; _userCategoryRepository.Create(userCategory); _unitOfWork.Commit(); _userCategoryService.Delete(userCategory); _unitOfWork.Commit(); UserCategory userCategoryFromDb = _userCategoryRepository.FindAll().FirstOrDefault(x => x.User.Id == DatabaseHelper.UserTest2A.Id && x.Category.Id == category.Id && x.CategoryFavouriteLevel.Id == favouriteLevel.Id); Assert.IsNull(userCategoryFromDb, "Category for user wasn't deleted"); }
public UserCategory Create(UserCategory userCategory) { return(_userCategoryRepository.Create(userCategory)); }