public LPCReportServiceTest() { var services = new ServiceCollection(); var builder = new ConfigurationBuilder(); builder.SetBasePath(Directory.GetCurrentDirectory()); builder.AddJsonFile("appsettings.json").Build(); var connectionStringConfig = builder.Build(); var dbonnection = connectionStringConfig.GetConnectionString("SqlServer"); services.AddDbContext <NYCLandmarkContext>(options => options.UseSqlServer(dbonnection)); services.AddScoped <ILPCReportRepository, LPCReportRepository>(); services.AddScoped <ILPCReportService, LPCReportService>(); serviceProvider = services.BuildServiceProvider(); dbContext = serviceProvider.GetRequiredService <NYCLandmarkContext>(); lpcReportRepository = serviceProvider.GetRequiredService <ILPCReportRepository>(); lbcReportService = serviceProvider.GetRequiredService <ILPCReportService>(); AutoMapperConfiguration.Configure(); }
/// <summary> /// /// </summary> /// <param name="lpcReportService"></param> /// <param name="landmarkService"></param> public LPCReportController(ILPCReportService lpcReportService, ILandmarkService landmarkService) { _lpcReportService = lpcReportService; _landmarkService = landmarkService; }