Esempio n. 1
0
 public void GetSpecificCategory_ShouldWork()
 {
     RunOnDatabase(async s =>
     {
         DestroyDatabase();
         // Arrange
         var fridgeRepo    = new FridgeRepository(s);
         var ingredCatRepo = new IngredientsCategoryRepository(s);
         var ingredRepo    = new IngredientsRepository(s, ingredCatRepo, fridgeRepo);
         var recipeRepo    = new RecipesRepository(s, fridgeRepo, ingredRepo);
         IEnumerable <IngredientCategory> categories = GetDefaultCategories();
         // Act
         Populate(s);
         await ingredRepo.AddIngredientCustom(recipeRepo.GetAll().Result.First().Id, "asfasfasfasfy", "cup", "i5", 1, 1, 1);
         await ingredRepo.AddIngredientCustom(recipeRepo.GetAll().Result.First().Id, "other-ingredients", "cup", "i6", 1, 1, 1);
         var res  = await ingredRepo.GetSpecificCategory("i5");
         var res2 = await ingredRepo.GetSpecificCategory("i6");
         var res1 = await ingredRepo.GetSpecificCategory("null");
         // Assert
         Assert.AreEqual(res, ingredCatRepo.GetByName("asfasfasfasfy").Result.Id);
         Assert.AreEqual(res2, null);
         Assert.AreEqual(null, res1);
     });
 }