Ejemplo n.º 1
0
        public async Task CreateIngredientTypeMustCreateProperly()
        {
            var ingredientTypeRepository = new Mock <IRepository <IngredientType> >();
            var ingredientRepository     = new Mock <IRepository <Ingredient> >();
            var service = new IngredientService(ingredientTypeRepository.Object, ingredientRepository.Object);

            var actualResult = await service.CreateIngredientType("Meat");

            Assert.True(actualResult == true, "Create Ingredient Type doest work properly.");
            ingredientTypeRepository.Verify(x => x.AddAsync(It.IsAny <IngredientType>()), Times.Once, "Create Ingredient Type was not called once.");
            ingredientTypeRepository.Verify(x => x.SaveChangesAsync(), Times.Once, "Create Ingredient Type saveChanges was not called once.");
        }