Switch ConfigureServices back to protected.
Downstream users may wish to subclass and add their application specific services.
This commit is contained in:
@@ -149,7 +149,7 @@ namespace Umbraco.Cms.Tests.Integration.TestServerTest
|
||||
context.HostingEnvironment = TestHelper.GetWebHostEnvironment();
|
||||
|
||||
ConfigureServices(services);
|
||||
ConfigureTestSpecificServices(services);
|
||||
ConfigureTestServices(services);
|
||||
|
||||
if (!TestOptions.Boot)
|
||||
{
|
||||
@@ -179,7 +179,7 @@ namespace Umbraco.Cms.Tests.Integration.TestServerTest
|
||||
|
||||
protected virtual T GetRequiredService<T>() => Factory.Services.GetRequiredService<T>();
|
||||
|
||||
private void ConfigureServices(IServiceCollection services)
|
||||
protected void ConfigureServices(IServiceCollection services)
|
||||
{
|
||||
services.AddUnique(CreateLoggerFactory());
|
||||
services.AddTransient<TestUmbracoDatabaseFactoryProvider>();
|
||||
@@ -228,7 +228,14 @@ namespace Umbraco.Cms.Tests.Integration.TestServerTest
|
||||
.Build();
|
||||
}
|
||||
|
||||
private void Configure(IApplicationBuilder app)
|
||||
/// <summary>
|
||||
/// Hook for registering test doubles.
|
||||
/// </summary>
|
||||
protected virtual void ConfigureTestServices(IServiceCollection services)
|
||||
{
|
||||
}
|
||||
|
||||
protected void Configure(IApplicationBuilder app)
|
||||
{
|
||||
UseTestDatabase(app);
|
||||
|
||||
|
||||
@@ -80,7 +80,7 @@ namespace Umbraco.Cms.Tests.Integration.Testing
|
||||
.ConfigureServices((_, services) =>
|
||||
{
|
||||
ConfigureServices(services);
|
||||
ConfigureTestSpecificServices(services);
|
||||
ConfigureTestServices(services);
|
||||
|
||||
if (!TestOptions.Boot)
|
||||
{
|
||||
@@ -93,7 +93,7 @@ namespace Umbraco.Cms.Tests.Integration.Testing
|
||||
return hostBuilder;
|
||||
}
|
||||
|
||||
private void ConfigureServices(IServiceCollection services)
|
||||
protected void ConfigureServices(IServiceCollection services)
|
||||
{
|
||||
services.AddUnique(CreateLoggerFactory());
|
||||
services.AddSingleton(TestHelper.DbProviderFactoryCreator);
|
||||
@@ -143,10 +143,23 @@ namespace Umbraco.Cms.Tests.Integration.Testing
|
||||
builder.Build();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Hook for altering UmbracoBuilder setup
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Can also be used for registering test doubles.
|
||||
/// </remarks>
|
||||
protected virtual void CustomTestSetup(IUmbracoBuilder builder)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Hook for registering test doubles.
|
||||
/// </summary>
|
||||
protected virtual void ConfigureTestServices(IServiceCollection services)
|
||||
{
|
||||
}
|
||||
|
||||
protected virtual T GetRequiredService<T>() => Services.GetRequiredService<T>();
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -107,10 +107,6 @@ public abstract class UmbracoIntegrationTestBase
|
||||
return NullLoggerFactory.Instance;
|
||||
}
|
||||
|
||||
protected virtual void ConfigureTestSpecificServices(IServiceCollection services)
|
||||
{
|
||||
}
|
||||
|
||||
protected void UseTestDatabase(IApplicationBuilder app)
|
||||
=> UseTestDatabase(app.ApplicationServices);
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ namespace Umbraco.Cms.Tests.Integration.Umbraco.Core.Events
|
||||
[TestFixture]
|
||||
public class EventAggregatorTests : UmbracoTestServerTestBase
|
||||
{
|
||||
protected override void ConfigureTestSpecificServices(IServiceCollection services)
|
||||
protected override void ConfigureTestServices(IServiceCollection services)
|
||||
{
|
||||
services.AddScoped<EventAggregatorTestScopedService>();
|
||||
services.AddTransient<INotificationHandler<EventAggregatorTestNotification>, EventAggregatorTestNotificationHandler>();
|
||||
|
||||
@@ -29,7 +29,7 @@ namespace Umbraco.Cms.Tests.Integration.Umbraco.Examine.Lucene.UmbracoExamine
|
||||
|
||||
protected IRuntimeState RunningRuntimeState { get; } = Mock.Of<IRuntimeState>(x => x.Level == RuntimeLevel.Run);
|
||||
|
||||
protected override void ConfigureTestSpecificServices(IServiceCollection services)
|
||||
protected override void ConfigureTestServices(IServiceCollection services)
|
||||
=> services.AddSingleton<IndexInitializer>();
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -31,7 +31,7 @@ namespace Umbraco.Cms.Tests.Integration.Umbraco.Infrastructure.Scoping
|
||||
public void SetUp() => Assert.IsNull(ScopeProvider.AmbientScope); // gone
|
||||
|
||||
|
||||
protected override void ConfigureTestSpecificServices(IServiceCollection services)
|
||||
protected override void ConfigureTestServices(IServiceCollection services)
|
||||
{
|
||||
// Need to have a mockable request cache for tests
|
||||
var appCaches = new AppCaches(
|
||||
|
||||
@@ -31,7 +31,7 @@ namespace Umbraco.Cms.Tests.Integration.Umbraco.Infrastructure.Scoping
|
||||
|
||||
private ILocalizationService LocalizationService => GetRequiredService<ILocalizationService>();
|
||||
|
||||
protected override void ConfigureTestSpecificServices(IServiceCollection services)
|
||||
protected override void ConfigureTestServices(IServiceCollection services)
|
||||
{
|
||||
// this is what's created core web runtime
|
||||
var appCaches = new AppCaches(
|
||||
|
||||
Reference in New Issue
Block a user