public MonumentReviewsServiceTests() { var services = new ServiceCollection(); services.AddDbContext <MbDbContext>(opt => opt.UseInMemoryDatabase(Guid.NewGuid().ToString())); services.AddScoped <IMonumentReviewsService, MonumentReviewsService>(); 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.monumentReviewsService = this.provider.GetService <IMonumentReviewsService>(); }
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; }
public MonumentReviewsController(IMonumentReviewsService monumentReviewsService, IMonumentsService monumentsService) { this.monumentReviewsService = monumentReviewsService; this.monumentsService = monumentsService; }