Ejemplo n.º 1
0
        public void CheckIfIngredientTypeExistByIdShouldWorkProperly()
        {
            var ingredientTypeRepository = new Mock <IRepository <IngredientType> >();
            var ingredientRepository     = new Mock <IRepository <Ingredient> >();

            ingredientTypeRepository.Setup(x => x.All()).Returns(this.DummyDataIngredientType().AsQueryable());
            var service = new IngredientService(ingredientTypeRepository.Object, ingredientRepository.Object);

            var actualResultWithExistingData    = service.CheckIfIngredientTypeExistById(1);
            var actualResullWithNonExistingData = service.CheckIfIngredientTypeExistById(5);

            Assert.True(actualResultWithExistingData == true, "CheckIfIngredientTypeExistById with correct data should return True.");
            Assert.True(actualResullWithNonExistingData == false, "CheckIfIngredientTypeExistById with non existing data should return False.");
        }