diff --git a/src/Umbraco.Tests.Integration/Mapping/ContentTypeModelMappingTests.cs b/src/Umbraco.Tests.Integration/Mapping/ContentTypeModelMappingTests.cs index d7663d6ebc..0b7a702b44 100644 --- a/src/Umbraco.Tests.Integration/Mapping/ContentTypeModelMappingTests.cs +++ b/src/Umbraco.Tests.Integration/Mapping/ContentTypeModelMappingTests.cs @@ -16,13 +16,12 @@ using Umbraco.Web.Models.ContentEditing; namespace Umbraco.Tests.Models.Mapping { [TestFixture] - [UmbracoTest(Mapper = true, Database = UmbracoTestOptions.Database.NewSchemaPerTest, Logger = UmbracoTestOptions.Logger.Mock)] + [UmbracoTest(Mapper = true, Database = UmbracoTestOptions.Database.NewSchemaPerTest)] public class ContentTypeModelMappingTests : UmbracoIntegrationTest { private IDataTypeService _dataTypeService; private UmbracoMapper _sut; private IFileService _fileService; - private IEntityService _entityService; [SetUp] @@ -31,7 +30,6 @@ namespace Umbraco.Tests.Models.Mapping _sut = Services.GetRequiredService(); _dataTypeService = Services.GetRequiredService(); _fileService = Services.GetRequiredService(); - _entityService = Services.GetRequiredService(); } [Test] diff --git a/src/Umbraco.Tests.Integration/Services/MacroServiceTests.cs b/src/Umbraco.Tests.Integration/Services/MacroServiceTests.cs index 254a7afbb4..2a5c3b0a9c 100644 --- a/src/Umbraco.Tests.Integration/Services/MacroServiceTests.cs +++ b/src/Umbraco.Tests.Integration/Services/MacroServiceTests.cs @@ -25,9 +25,10 @@ namespace Umbraco.Tests.Integration.Services [SetUp] public void SetupTest() { - using (var scope = ScopeProvider.CreateScope()) + var scopeProvider = ScopeProvider; + using (var scope = scopeProvider.CreateScope()) { - var repository = new MacroRepository((IScopeAccessor) sp, AppCaches.Disabled, Mock.Of>(), ShortStringHelper); + var repository = new MacroRepository((IScopeAccessor) scopeProvider, AppCaches.Disabled, Mock.Of>(), ShortStringHelper); repository.Save(new Macro(ShortStringHelper, "test1", "Test1", "~/views/macropartials/test1.cshtml")); repository.Save(new Macro(ShortStringHelper, "test2", "Test2", "~/views/macropartials/test2.cshtml")); diff --git a/src/Umbraco.Tests.Integration/Testing/LocalDbTestDatabase.cs b/src/Umbraco.Tests.Integration/Testing/LocalDbTestDatabase.cs index 10f8621b1a..39f9ca5592 100644 --- a/src/Umbraco.Tests.Integration/Testing/LocalDbTestDatabase.cs +++ b/src/Umbraco.Tests.Integration/Testing/LocalDbTestDatabase.cs @@ -236,10 +236,10 @@ namespace Umbraco.Tests.Integration.Testing action(); return; } - catch (SqlException e) + catch (SqlException) { - Console.Error.WriteLine($"SqlException occured, but we try again {i+1}/{maxIterations}.\n{e}"); + //Console.Error.WriteLine($"SqlException occured, but we try again {i+1}/{maxIterations}.\n{e}"); // This can occur when there's a transaction deadlock which means (i think) that the database is still in use and hasn't been closed properly yet // so we need to just wait a little bit Thread.Sleep(100 * i); @@ -249,6 +249,10 @@ namespace Umbraco.Tests.Integration.Testing throw; } } + catch (InvalidOperationException) + { + + } } } diff --git a/src/Umbraco.Tests.Integration/Testing/UmbracoIntegrationTest.cs b/src/Umbraco.Tests.Integration/Testing/UmbracoIntegrationTest.cs index f2cb917ed1..30b5545aa3 100644 --- a/src/Umbraco.Tests.Integration/Testing/UmbracoIntegrationTest.cs +++ b/src/Umbraco.Tests.Integration/Testing/UmbracoIntegrationTest.cs @@ -128,7 +128,7 @@ namespace Umbraco.Tests.Integration.Testing { UmbracoContainer = CreateUmbracoContainer(out var serviceProviderFactory); _serviceProviderFactory = serviceProviderFactory; - // TODO: Is this the right way to do this? + var hostBuilder = Host.CreateDefaultBuilder() // IMPORTANT: We Cannot use UseStartup, there's all sorts of threads about this with testing. Although this can work // if you want to setup your tests this way, it is a bit annoying to do that as the WebApplicationFactory will