public void ReadElementById_Invalid_Input()
        {
            var dbContext = new Mock <IDbContext>();
            var logger    = new Mock <ILogger <RecipesDbService> >();

            var rcpDbService = new RecipesDbService(dbContext.Object, logger.Object);

            Assert.Null(rcpDbService.ReadElementById(0));
            Assert.Null(rcpDbService.ReadElementById(-1));
        }
        public void ReadElementById_Valid_Data_In_Table()
        {
            var recipe = Utils.CreateMockDbSet(new List <Recipe>
            {
                new Recipe()
                {
                    RecipeID        = 1,
                    FinishedProduct = 10
                }
            });


            var dbContext = new Mock <IDbContext>();

            dbContext.Setup(d => d.Recipes).Returns(recipe.Object);
            var logger       = new Mock <ILogger <RecipesDbService> >();
            var rcpDbService = new RecipesDbService(dbContext.Object, logger.Object);

            var result = rcpDbService.ReadElementById(1);

            logger.Verify(l => l.Log(It.IsAny <LogLevel>(), It.IsAny <EventId>(), It.IsAny <FormattedLogValues>(), It.IsAny <Exception>(), It.IsAny <Func <object, Exception, string> >()), Times.Never);

            Assert.True(result.RecipeID == 1);
            Assert.True(result.FinishedProduct == 10);
        }
        public void ReadElementById_Valid_Input_No_Such_Table()
        {
            var dbContext = new Mock <IDbContext>();
            var logger    = new Mock <ILogger <RecipesDbService> >();

            var rcpDbService = new RecipesDbService(dbContext.Object, logger.Object);

            var result = rcpDbService.ReadElementById(1);

            logger.Verify(l => l.Log(It.IsAny <LogLevel>(), It.IsAny <EventId>(), It.IsAny <FormattedLogValues>(), It.IsAny <Exception>(), It.IsAny <Func <object, Exception, string> >()), Times.Once);
            Assert.Null(result);
        }