public MonumentCommentsServiceTests()
        {
            var services = new ServiceCollection();

            services.AddDbContext <MbDbContext>(opt =>
                                                opt.UseInMemoryDatabase(Guid.NewGuid().ToString()));
            services.AddScoped <IMonumentCommentsService, MonumentCommentsService>();
            services.AddScoped <IMonumentsService, MonumentsService>();
            services.AddScoped <IUsersService, UsersService>();
            services.AddScoped <IOblastsService, OblastsService>();

            Mapper.Reset();
            Mapper.Initialize(config => config.AddProfile(typeof(MonumentsProfile)));
            services.AddScoped <IMapper>(service => Mapper.Instance);

            var account = new Account(GlobalConstants.CloudinaryName,
                                      GlobalConstants.CloudinaryKey, GlobalConstants.CloudinarySecret);

            services.AddScoped(x => new Cloudinary(account));
            services.AddScoped <ImagesUploader>();

            this.provider  = services.BuildServiceProvider();
            this.dbContext = this.provider.GetService <MbDbContext>();
            this.monumentCommentsService = this.provider.GetService <IMonumentCommentsService>();
        }
 public MonumentsController(
     IMonumentsService monumentsService,
     IMonumentReviewsService monumentReviewsService,
     IMonumentCommentsService monumentCommentsService,
     IOblastsService oblastsService,
     IMapper mapper)
 {
     this.monumentsService        = monumentsService;
     this.monumentReviewsService  = monumentReviewsService;
     this.monumentCommentsService = monumentCommentsService;
     this.oblastsService          = oblastsService;
     this.mapper = mapper;
 }
예제 #3
0
 public MonumentCommentsController(IMonumentCommentsService monumentCommentsService)
 {
     this.monumentCommentsService = monumentCommentsService;
 }