Example #1
0
        private void CreateImageService(ApplicationDbContext dbContext)
        {
            var tagRepository = new EfDeletableEntityRepository <Tag>(dbContext);
            var tagService    = new TagsService(tagRepository);

            var userSubscribeRepository = new EfDeletableEntityRepository <UserSubscribe>(dbContext);
            var imageTagRepository      = new EfDeletableEntityRepository <ImageTag>(dbContext);
            var imageCategoryRepository = new EfDeletableEntityRepository <ImageCategory>(dbContext);
            var userRepository          = new EfDeletableEntityRepository <ApplicationUser>(dbContext);

            var tempCloudImageRepository = new EfRepository <TempCloudImage>(dbContext);

            this.tempCloudImagesService = new TempCloudImagesService(tempCloudImageRepository);

            var logger = Mock.Of <ILogger <ImagesService> >();

            this.imagesService = new ImagesService(
                logger,
                this.imageRepository,
                this.voteRepository,
                userSubscribeRepository,
                imageTagRepository,
                tagRepository,
                imageCategoryRepository,
                userRepository,
                this.categoriesService,
                tagService,
                this.tempCloudImagesService);
        }
        private void InitTestServices()
        {
            var options = new DbContextOptionsBuilder <ApplicationDbContext>()
                          .UseInMemoryDatabase(Guid.NewGuid().ToString());

            ApplicationDbContext dbContext = new ApplicationDbContext(options.Options);

            this.repository = new EfRepository <TempCloudImage>(dbContext);

            this.service = new TempCloudImagesService(this.repository);
        }
        private void InitTestServices()
        {
            var options = new DbContextOptionsBuilder <ApplicationDbContext>()
                          .UseInMemoryDatabase(Guid.NewGuid().ToString());

            ApplicationDbContext dbContext = new ApplicationDbContext(options.Options);

            this.imageRepository = new EfDeletableEntityRepository <Image>(dbContext);

            var tagRepository = new EfDeletableEntityRepository <Tag>(dbContext);

            this.tagService = new TagsService(tagRepository);

            this.imageCategoryRepository = new EfDeletableEntityRepository <ImageCategory>(dbContext);

            var tempCloudImageRepository = new EfRepository <TempCloudImage>(dbContext);

            this.tempCloudImageService = new TempCloudImagesService(tempCloudImageRepository);

            this.voteRepository = new EfRepository <Vote>(dbContext);

            var userSubscribeRepository = new EfDeletableEntityRepository <UserSubscribe>(dbContext);

            this.imageTagRepository = new EfDeletableEntityRepository <ImageTag>(dbContext);
            this.userRepository     = new EfDeletableEntityRepository <ApplicationUser>(dbContext);

            var categoryRepository = new EfDeletableEntityRepository <Category>(dbContext);
            var loggerCategory     = Mock.Of <ILogger <CategoriesService> >();

            this.categoriesService = new CategoriesService(
                loggerCategory,
                categoryRepository,
                this.voteRepository,
                this.imageRepository,
                this.imageCategoryRepository);

            var logger = Mock.Of <ILogger <ImagesService> >();

            this.imagesService = new ImagesService(
                logger,
                this.imageRepository,
                this.voteRepository,
                userSubscribeRepository,
                this.imageTagRepository,
                tagRepository,
                this.imageCategoryRepository,
                this.userRepository,
                this.categoriesService,
                this.tagService,
                this.tempCloudImageService);
        }