public async Task CreateNewIngredientWithExistingName()
        {
            IngredientModel newIngredient = new IngredientModel
            {
                Id   = 3,
                Name = "Mushrooms"
            };

            repoMock.Setup(x => x.GetByExpressionAsync(It.IsAny <Expression <Func <IngredientModel, bool> > >(), null)).Returns(GetFakeIngredientByName(newIngredient.Name));
            repoMock.Setup(x => x.CreateAsync(newIngredient)).Returns(Task.FromResult(true));

            uowMock.Setup(x => x.Ingredients).Returns(repoMock.Object);

            IIngredientService ingredientService = new IngredientService(uowMock.Object);

            await ingredientService.CreateAsync(newIngredient);

            IServiceResult <IngredientModel> result = await ingredientService.CreateAsync(newIngredient);

            Assert.AreEqual(ResultType.Error, result.Result);
            Assert.IsNull(result.ReturnedObject);
            Assert.AreEqual(1, result.Errors.Count);
            Assert.AreEqual($"Ingredient with name {newIngredient.Name} already exists in database", result.Errors.First());
        }
        public async Task CreateNewIngredient()
        {
            IngredientModel newIngredient = new IngredientModel
            {
                Id   = 3,
                Name = "Tomato"
            };

            repoMock.Setup(x => x.GetByExpressionAsync(It.IsAny <Expression <Func <IngredientModel, bool> > >(), null)).Returns(GetFakeIngredientByName(newIngredient.Name));
            repoMock.Setup(x => x.CreateAsync(newIngredient)).Returns(Task.FromResult(true));

            uowMock.Setup(x => x.Ingredients).Returns(repoMock.Object);

            IIngredientService ingredientService = new IngredientService(uowMock.Object);

            IServiceResult <IngredientModel> result = await ingredientService.CreateAsync(newIngredient);

            Assert.AreEqual(ResultType.Created, result.Result);
            Assert.IsNotNull(result.ReturnedObject);
            Assert.AreEqual(newIngredient.Id, result.ReturnedObject.Id);
            Assert.AreEqual(newIngredient.Name, result.ReturnedObject.Name);
        }