Fixing tests after merge

This commit is contained in:
Shannon
2020-12-21 16:44:50 +11:00
parent 86adf01f88
commit 03f22e9362
5 changed files with 53 additions and 34 deletions

View File

@@ -50,7 +50,10 @@ namespace Umbraco.Tests.Integration.Testing
public void OnTestTearDown(Action tearDown)
{
if (_testTeardown == null)
{
_testTeardown = new List<Action>();
}
_testTeardown.Add(tearDown);
}
@@ -60,7 +63,9 @@ namespace Umbraco.Tests.Integration.Testing
public void FixtureTearDown()
{
foreach (var a in _fixtureTeardown)
{
a();
}
}
[TearDown]
@@ -69,7 +74,9 @@ namespace Umbraco.Tests.Integration.Testing
if (_testTeardown != null)
{
foreach (var a in _testTeardown)
{
a();
}
}
_testTeardown = null;
@@ -107,7 +114,7 @@ namespace Umbraco.Tests.Integration.Testing
Configure(app);
}
protected void BeforeHostStart(IHost host)
protected virtual void BeforeHostStart(IHost host)
{
Services = host.Services;
UseTestDatabase(Services);
@@ -149,7 +156,6 @@ namespace Umbraco.Tests.Integration.Testing
/// <summary>
/// Create the Generic Host and execute startup ConfigureServices/Configure calls
/// </summary>
/// <returns></returns>
public virtual IHostBuilder CreateHostBuilder()
{
var hostBuilder = Host.CreateDefaultBuilder()
@@ -183,8 +189,6 @@ namespace Umbraco.Tests.Integration.Testing
#endregion
#region IStartup
public virtual void ConfigureServices(IServiceCollection services)
{
services.AddSingleton(TestHelper.DbProviderFactoryCreator);
@@ -245,8 +249,6 @@ namespace Umbraco.Tests.Integration.Testing
app.UseUmbracoCore(); // This no longer starts CoreRuntime, it's very fast
}
#endregion
#region LocalDb
private static readonly object _dbLocker = new object();
@@ -387,8 +389,6 @@ namespace Umbraco.Tests.Integration.Testing
#endregion
#region Common services
protected UmbracoTestAttribute TestOptions => TestOptionAttributeBase.GetTestOptions<UmbracoTestAttribute>();
protected virtual T GetRequiredService<T>() => Services.GetRequiredService<T>();
@@ -420,13 +420,16 @@ namespace Umbraco.Tests.Integration.Testing
/// Returns the <see cref="ILoggerFactory"/>
/// </summary>
protected ILoggerFactory LoggerFactory => Services.GetRequiredService<ILoggerFactory>();
protected AppCaches AppCaches => Services.GetRequiredService<AppCaches>();
protected IIOHelper IOHelper => Services.GetRequiredService<IIOHelper>();
protected IShortStringHelper ShortStringHelper => Services.GetRequiredService<IShortStringHelper>();
protected GlobalSettings GlobalSettings => Services.GetRequiredService<IOptions<GlobalSettings>>().Value;
protected IMapperCollection Mappers => Services.GetRequiredService<IMapperCollection>();
#endregion
protected AppCaches AppCaches => Services.GetRequiredService<AppCaches>();
protected IIOHelper IOHelper => Services.GetRequiredService<IIOHelper>();
protected IShortStringHelper ShortStringHelper => Services.GetRequiredService<IShortStringHelper>();
protected GlobalSettings GlobalSettings => Services.GetRequiredService<IOptions<GlobalSettings>>().Value;
protected IMapperCollection Mappers => Services.GetRequiredService<IMapperCollection>();
#region Builders