public void user_can_add_new_categories_to_observe()
        {
            var category       = _categoryRepository.FindAll().FirstOrDefault();
            var favouriteLevel = _categoryFavouriteLevelRepository.FindAll().FirstOrDefault();
            var userCategory   = new UserCategory {
                User = DatabaseHelper.UserTest1, Category = category, CategoryFavouriteLevel = favouriteLevel
            };

            _unitOfWork.Commit();

            _userCategoryService.Create(userCategory);
            _unitOfWork.Commit();

            UserCategory userCategoryFromDb = _userCategoryRepository.FindAll().FirstOrDefault(x => x.User.Id == DatabaseHelper.UserTest1.Id &&
                                                                                               x.Category.Id == category.Id && x.CategoryFavouriteLevel.Id == favouriteLevel.Id);

            Assert.IsNotNull(userCategoryFromDb, "Category for user wasn't created");
        }
Beispiel #2
0
 public IList <CategoryFavouriteLevel> FindAll()
 {
     return(_categoryFavouriteLevelRepository.FindAll().ToList());
 }