예제 #1
0
        public void CheckIfIngredientTypeExistsByNameShouldReturnTrueIfExists()
        {
            var ingredientTypeRepository = new Mock <IRepository <IngredientType> >();
            var ingredientRepository     = new Mock <IRepository <Ingredient> >();
            var service = new IngredientService(ingredientTypeRepository.Object, ingredientRepository.Object);

            ingredientTypeRepository.Setup(x => x.All()).Returns(this.DummyDataIngredientType().AsQueryable());

            var expectedResultExistingType    = service.CheckIfIngredientTypeExistByName("Meat");
            var expectedResultNonExistingType = service.CheckIfIngredientTypeExistByName("Mea");

            Assert.True(expectedResultExistingType == true, "Ingredient Type Check should return True.");
            Assert.True(expectedResultNonExistingType == false, "Ingredient Type Check should return False.");
        }