* It worked before i must have broken it somehow. Commit as checkpoint * Adding a reference from Web.UI.csproj to TestData to allow composers to be composed * Changing readme and removing project reference
This commit is contained in:
@@ -3,17 +3,17 @@ using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Umbraco.Cms.Core.DependencyInjection;
|
||||
using Umbraco.Cms.Web.Common.ApplicationBuilder;
|
||||
using Umbraco.Cms.Web.Website.Collections;
|
||||
using Umbraco.TestData.Configuration;
|
||||
|
||||
namespace Umbraco.TestData.Extensions;
|
||||
|
||||
public static class UmbracoBuilderExtensions
|
||||
{
|
||||
public static IUmbracoBuilder AddUmbracoTestData(this IUmbracoBuilder builder)
|
||||
public static IUmbracoBuilder AddUmbracoLoadTest(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;
|
||||
}
|
||||
|
||||
@@ -26,7 +26,6 @@ public static class UmbracoBuilderExtensions
|
||||
|
||||
builder.Services.Configure<TestDataSettings>(testDataSection);
|
||||
|
||||
|
||||
builder.Services.Configure<UmbracoPipelineOptions>(options =>
|
||||
options.AddFilter(new UmbracoPipelineFilter(nameof(LoadTestController))
|
||||
{
|
||||
@@ -41,4 +40,26 @@ public static class UmbracoBuilderExtensions
|
||||
|
||||
return builder;
|
||||
}
|
||||
|
||||
public static IUmbracoBuilder AddUmbracoTestData(this IUmbracoBuilder builder)
|
||||
{
|
||||
if (builder.Services.Any(x => x.ServiceType == typeof(UmbracoTestDataController)))
|
||||
{
|
||||
return builder;
|
||||
}
|
||||
|
||||
var testDataSection = builder.Config.GetSection("Umbraco:CMS:TestData");
|
||||
var config = testDataSection.Get<TestDataSettings>();
|
||||
if (config == null || config.Enabled == false)
|
||||
{
|
||||
return builder;
|
||||
}
|
||||
|
||||
builder.Services.Configure<TestDataSettings>(testDataSection);
|
||||
|
||||
builder.WithCollectionBuilder<SurfaceControllerTypeCollectionBuilder>()
|
||||
.Add<UmbracoTestDataController>();
|
||||
|
||||
return builder;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user