Beispiel #1
0
        public void ShouldAddIngredient()
        {
            var ingredient = IngredientBuilder.BuildIngredient();

            _ingredientRepository.Add(ingredient);
            _ingredientRepository.Persist();

            _ingredientRepository.FindOne(i => i != null).IngredientName.ShouldEqual(ingredient.IngredientName);

            using (var dataContext = GetNewDataContext())
            {
                var result = dataContext.GetTable <Ingredient>().Single(i => i != null);
                result.IngredientName.ShouldEqual(ingredient.IngredientName);
            }
        }
Beispiel #2
0
        public void ShouldAddNewPurchaseAdviceWithNoDuplicateMentorsAndSemaphores()
        {
            var addedAdvice = _ingredientAdviceDomainService.AddIngredientAdvice(_mentor, _ingredient, _redSemaphore, "some label", "some intro",
                                                                                 "Advice 1", "some keywords", false);

            var addedAdvice2 = _ingredientAdviceDomainService.AddIngredientAdvice(_mentor, _ingredient, _redSemaphore, "some label", "some intro",
                                                                                  "Advice 2", "some keywords", false);

            addedAdvice.Id.ShouldNotEqual(addedAdvice2.Id);

            _ingredient = _ingredientRepository.FindOne(p => p.Id != 0);
            _ingredient.IngredientAdvices.Count.ShouldEqual(2);

            var mentors = _mentorRepository.Find(x => !x.MentorName.Equals(string.Empty)).ToList();

            mentors.Count.ShouldEqual(1);
            var semaphores = _semaphoreRepository.Find(x => !x.Value.Equals(-99)).ToList();

            semaphores.Count.ShouldEqual(2);
        }
Beispiel #3
0
 public Ingredient GetIngredientById(int ingredientId)
 {
     return(_ingredientRepository.FindOne(x => x.Id == ingredientId));
 }