Exemplo n.º 1
0
        public void GetRecipesSuccesTest()
        {
            //Arrange
            MockRecipeRepository mockRecipeRepository = new MockRecipeRepository();

            mockRecipeRepository.recipes.Add(new Models.Recipe {
                Title = "1", Content = "1"
            });
            mockRecipeRepository.recipes.Add(new Models.Recipe {
                Title = "2", Content = "2"
            });
            mockRecipeRepository.recipes.Add(new Models.Recipe {
                Title = "3", Content = "3"
            });
            mockRecipeRepository.recipes.Add(new Models.Recipe {
                Title = "4", Content = "4"
            });
            mockRecipeRepository.recipes.Add(new Models.Recipe {
                Title = "5", Content = "5"
            });
            Services.RecipeService recipeService = new Services.RecipeService(mockRecipeRepository);

            //Act
            var result = recipeService.GetRecipes(0);

            //Assert
            Assert.AreEqual(5, mockRecipeRepository.recipes.Count);
            Assert.AreEqual(5, result.Count);
        }
Exemplo n.º 2
0
        public void PostRecipeSuccesTest()
        {
            //Arrange
            MockRecipeRepository mockRecipeRepository = new MockRecipeRepository();

            Services.RecipeService recipeService = new Services.RecipeService(mockRecipeRepository);

            //Act
            _ = recipeService.PostRecipe(new Models.Recipe {
                Content = "Hallo", Title = "Title"
            });

            //Assert
            Assert.AreEqual(1, mockRecipeRepository.recipes.Count);
            Assert.AreEqual("Hallo", mockRecipeRepository.recipes[0].Content);
            Assert.AreEqual("Title", mockRecipeRepository.recipes[0].Title);
        }