public RestaurantImagesControllerTests()
        {
            this.dbContext     = MockDbContext.GetContext();
            this.configuration = new ConfigurationBuilder()
                                 .AddJsonFile("settings.json")
                                 .Build();

            this.restaurantImagesRepository = new EfDeletableEntityRepository <RestaurantImage>(this.dbContext);
            this.restaurantRepository       = new EfDeletableEntityRepository <Restaurant>(this.dbContext);
            this.userRepository             = new EfDeletableEntityRepository <ApplicationUser>(this.dbContext);
            this.voteRepository             = new EfRepository <Vote>(this.dbContext);
            this.commentRepository          = new EfDeletableEntityRepository <Comment>(this.dbContext);

            this.voteService             = new VoteService(this.voteRepository);
            this.commentService          = new CommentService(this.commentRepository, this.voteService);
            this.userImageService        = new UserImageService(this.userRepository, this.cloudinaryService);
            this.cloudinaryService       = new CloudinaryImageService(this.configuration);
            this.restaurantImagesService = new RestaurantImageService(this.restaurantImagesRepository, this.cloudinaryService);
            this.restaurantService       = new RestaurantService(this.restaurantRepository, this.restaurantImagesService, this.commentService);
            this.userService             = new UserService(this.restaurantService, this.userImageService, this.userRepository);

            var httpContext = new DefaultHttpContext();
            var tempData    = new TempDataDictionary(httpContext, Mock.Of <ITempDataProvider>());

            this.controller = new RestaurantImagesController(this.restaurantImagesService, this.userService, this.restaurantService)
            {
                TempData = tempData,
            };
        }
Пример #2
0
 public UserService(
     IRestaurantService restaurantService,
     IUserImageSercice imageService,
     IDeletableEntityRepository <ApplicationUser> usersRepository)
 {
     this.restaurantService = restaurantService;
     this.imageService      = imageService;
     this.usersRepository   = usersRepository;
 }
 public ExternalLoginModel(
     SignInManager <ApplicationUser> signInManager,
     UserManager <ApplicationUser> userManager,
     IUserImageSercice imageSercice,
     ILogger <ExternalLoginModel> logger,
     IEmailSender emailSender)
 {
     this.signInManager = signInManager;
     this.userManager   = userManager;
     this.imageSercice  = imageSercice;
     this.logger        = logger;
     this.emailSender   = emailSender;
 }
        public RestaurantsControllerTests()
        {
            this.dbContext     = MockDbContext.GetContext();
            this.configuration = new ConfigurationBuilder()
                                 .AddJsonFile("settings.json")
                                 .Build();

            this.restaurantImagesRepository = new EfDeletableEntityRepository <RestaurantImage>(this.dbContext);
            this.categoryImageRepository    = new EfDeletableEntityRepository <CategoryImage>(this.dbContext);
            this.restaurantRepository       = new EfDeletableEntityRepository <Restaurant>(this.dbContext);
            this.categoryRepository         = new EfDeletableEntityRepository <Category>(this.dbContext);
            this.userRepository             = new EfDeletableEntityRepository <ApplicationUser>(this.dbContext);
            this.favouriteRepository        = new EfRepository <FavouriteRestaurant>(this.dbContext);
            this.voteRepository             = new EfRepository <Vote>(this.dbContext);
            this.commentRepository          = new EfDeletableEntityRepository <Comment>(this.dbContext);

            this.cloudinaryService       = new CloudinaryImageService(this.configuration);
            this.voteService             = new VoteService(this.voteRepository);
            this.commentService          = new CommentService(this.commentRepository, this.voteService);
            this.restaurantImagesService = new RestaurantImageService(this.restaurantImagesRepository, this.cloudinaryService);
            this.restaurantService       = new RestaurantService(this.restaurantRepository, this.restaurantImagesService, this.commentService);
            this.userImageService        = new UserImageService(this.userRepository, this.cloudinaryService);

            this.categoryImageService = new CategoryImageService(this.categoryImageRepository, this.cloudinaryService);
            this.categoryService      = new CategoryService(this.categoryRepository, this.categoryImageService, this.restaurantService);
            this.userService          = new UserService(this.restaurantService, this.userImageService, this.userRepository);
            this.favouriteService     = new FavouriteService(this.favouriteRepository);

            var httpContext = new DefaultHttpContext();
            var tempData    = new TempDataDictionary(httpContext, Mock.Of <ITempDataProvider>());

            this.controller = new RestaurantsController(this.restaurantService, this.categoryService, this.userService, this.configuration, this.favouriteService)
            {
                TempData = tempData,
            };
            AutoMapperConfig.RegisterMappings(typeof(AllImagesFromRestaurantViewModel).Assembly);
        }