示例#1
0
        public RecipeService(
            IDbSet <Recipe> set,
            IIngredientTypesService ingredientTypesService,
            IRecipeIngredientsService ingredientsService,
            IRecipeImagesService recipeImagesService,
            IRecipeStepsService recipeStepsService,
            IDbContext context)
            : base(set, context)
        {
            if (ingredientTypesService == null)
            {
                throw new ArgumentNullException();
            }

            if (ingredientsService == null)
            {
                throw new ArgumentNullException(nameof(ingredientsService));
            }

            if (recipeImagesService == null)
            {
                throw new ArgumentNullException(nameof(recipeImagesService));
            }

            if (recipeStepsService == null)
            {
                throw new ArgumentNullException(nameof(recipeStepsService));
            }

            this.ingredientTypesService = ingredientTypesService;
            this.ingredientsService     = ingredientsService;
            this.recipeImagesService    = recipeImagesService;
            this.recipeStepsService     = recipeStepsService;
        }
        public void Initialize()
        {
            var dataGenerator = new TestDataGenerator();

            this.context = dataGenerator.GenerateContext();
            this.set     = this.context.RecipeImages;
            this.service = new RecipeImagesService(this.set, this.context);
        }