Fixing build and weird protected fields in UmbracoIntegrationTest

This commit is contained in:
Shannon
2021-03-04 16:18:57 +11:00
parent df9da835b3
commit a41323f389
16 changed files with 21 additions and 38 deletions

View File

@@ -88,8 +88,8 @@ namespace Umbraco.Cms.Tests.Integration.Testing
}
_testTeardown = null;
FirstTestInFixture = false;
FirstTestInSession = false;
_firstTestInFixture = false;
s_firstTestInSession = false;
// Ensure CoreRuntime stopped (now it's a HostedService)
IHost host = Services.GetRequiredService<IHost>();
@@ -103,7 +103,7 @@ namespace Umbraco.Cms.Tests.Integration.Testing
[SetUp]
public virtual void SetUp_Logging() =>
TestContext.Progress.Write($"Start test {TestCount++}: {TestContext.CurrentContext.Test.Name}");
TestContext.Progress.Write($"Start test {s_testCount++}: {TestContext.CurrentContext.Test.Name}");
[SetUp]
public virtual void Setup()
@@ -245,7 +245,6 @@ namespace Umbraco.Cms.Tests.Integration.Testing
{
if (TestOptions.Boot)
{
Services.GetRequiredService<IBackOfficeSecurityFactory>().EnsureBackOfficeSecurity();
Services.GetRequiredService<IUmbracoContextFactory>().EnsureUmbracoContext();
}
@@ -348,7 +347,7 @@ namespace Umbraco.Cms.Tests.Integration.Testing
// Only attach schema once per fixture
// Doing it more than once will block the process since the old db hasn't been detached
// and it would be the same as NewSchemaPerTest even if it didn't block
if (FirstTestInFixture)
if (_firstTestInFixture)
{
// New DB + Schema
TestDbMeta newSchemaFixtureDbMeta = db.AttachSchema();
@@ -365,7 +364,7 @@ namespace Umbraco.Cms.Tests.Integration.Testing
// Only attach schema once per fixture
// Doing it more than once will block the process since the old db hasn't been detached
// and it would be the same as NewSchemaPerTest even if it didn't block
if (FirstTestInFixture)
if (_firstTestInFixture)
{
// New DB + Schema
TestDbMeta newEmptyFixtureDbMeta = db.AttachEmpty();
@@ -438,12 +437,11 @@ namespace Umbraco.Cms.Tests.Integration.Testing
protected IMapperCollection Mappers => Services.GetRequiredService<IMapperCollection>();
protected UserBuilder UserBuilderInstance = new UserBuilder();
protected UserGroupBuilder UserGroupBuilderInstance = new UserGroupBuilder();
protected UserBuilder UserBuilderInstance { get; } = new UserBuilder();
protected UserGroupBuilder UserGroupBuilderInstance { get; } = new UserGroupBuilder();
protected static bool FirstTestInSession = true;
protected bool FirstTestInFixture = true;
protected static int TestCount = 1;
private static bool s_firstTestInSession = true;
private bool _firstTestInFixture = true;
private static int s_testCount = 1;
}
}