public UmbracoTestDataController(
     IUmbracoContextAccessor umbracoContextAccessor,
     IUmbracoDatabaseFactory databaseFactory,
     ServiceContext services,
     AppCaches appCaches,
     IProfilingLogger profilingLogger,
     IPublishedUrlProvider publishedUrlProvider,
     ICoreScopeProvider scopeProvider,
     PropertyEditorCollection propertyEditors,
     IShortStringHelper shortStringHelper,
     IOptions <TestDataSettings> testDataSettings)
     : base(umbracoContextAccessor, databaseFactory, services, appCaches, profilingLogger, publishedUrlProvider)
 {
     _scopeProvider     = scopeProvider;
     _propertyEditors   = propertyEditors;
     _shortStringHelper = shortStringHelper;
     _testDataSettings  = testDataSettings.Value;
 }
        public static IUmbracoBuilder AddUmbracoTestData(this IUmbracoBuilder builder)
        {
            if (builder.Services.Any(x => x.ServiceType == typeof(LoadTestController)))
            {
                // We assume the test data project is composed if any implementations of LoadTestController exist.
                return(builder);
            }

            IConfigurationSection testDataSection = builder.Config.GetSection("Umbraco:CMS:TestData");
            TestDataSettings      config          = testDataSection.Get <TestDataSettings>();

            if (config == null || config.Enabled == false)
            {
                return(builder);
            }

            builder.Services.Configure <TestDataSettings>(testDataSection);

            if (config.IgnoreLocalDb)
            {
                builder.Services.AddSingleton(factory => new PublishedSnapshotServiceOptions
                {
                    IgnoreLocalDb = true
                });
            }

            builder.Services.Configure <UmbracoPipelineOptions>(options =>
                                                                options.AddFilter(new UmbracoPipelineFilter(nameof(LoadTestController))
            {
                Endpoints = app => app.UseEndpoints(endpoints =>
                                                    endpoints.MapControllerRoute(
                                                        "LoadTest",
                                                        "/LoadTest/{action}",
                                                        new { controller = "LoadTest", Action = "Index" }))
            }));

            builder.Services.AddScoped(typeof(LoadTestController));

            return(builder);
        }
 public DataStore(IOptions <TestDataSettings> testDataSettingsOptions)
 {
     this.testDataSettings = testDataSettingsOptions.Value;
 }