From 67b1a8a3189a1402b86c2e55fd3e651892dae9fd Mon Sep 17 00:00:00 2001 From: Bjarke Berg Date: Fri, 19 Jun 2020 06:59:20 +0200 Subject: [PATCH] Test remove setup class, as it is potentially running too early Signed-off-by: Bjarke Berg --- .../Controllers/ContentControllerTests.cs | 64 ++++++++++++++----- 1 file changed, 49 insertions(+), 15 deletions(-) diff --git a/src/Umbraco.Tests.Integration/TestServerTest/Controllers/ContentControllerTests.cs b/src/Umbraco.Tests.Integration/TestServerTest/Controllers/ContentControllerTests.cs index 725e299193..325bd250ac 100644 --- a/src/Umbraco.Tests.Integration/TestServerTest/Controllers/ContentControllerTests.cs +++ b/src/Umbraco.Tests.Integration/TestServerTest/Controllers/ContentControllerTests.cs @@ -20,17 +20,6 @@ namespace Umbraco.Tests.Integration.TestServerTest.Controllers [UmbracoTest(Database = UmbracoTestOptions.Database.NewSchemaPerTest)] public class ContentControllerTests : UmbracoTestServerTestBase { - [SetUp] - public void Setup() - { - var localizationService = GetRequiredService(); - - //Add another language - localizationService.Save(new LanguageBuilder() - .WithCultureInfo("da-DK") - .WithIsDefault(false) - .Build()); - } /// /// Returns 404 if the content wasn't found based on the ID specified @@ -39,6 +28,14 @@ namespace Umbraco.Tests.Integration.TestServerTest.Controllers [Test] public async Task PostSave_Validate_Existing_Content() { + var localizationService = GetRequiredService(); + + //Add another language + localizationService.Save(new LanguageBuilder() + .WithCultureInfo("da-DK") + .WithIsDefault(false) + .Build()); + var url = PrepareUrl(x => x.PostSave(null)); var contentService = GetRequiredService(); @@ -90,6 +87,15 @@ namespace Umbraco.Tests.Integration.TestServerTest.Controllers [Test] public async Task PostSave_Validate_At_Least_One_Variant_Flagged_For_Saving() { + + var localizationService = GetRequiredService(); + + //Add another language + localizationService.Save(new LanguageBuilder() + .WithCultureInfo("da-DK") + .WithIsDefault(false) + .Build()); + var url = PrepareUrl(x => x.PostSave(null)); @@ -155,6 +161,14 @@ namespace Umbraco.Tests.Integration.TestServerTest.Controllers [Test] public async Task PostSave_Validate_Properties_Exist() { + var localizationService = GetRequiredService(); + + //Add another language + localizationService.Save(new LanguageBuilder() + .WithCultureInfo("da-DK") + .WithIsDefault(false) + .Build()); + var url = PrepareUrl(x => x.PostSave(null)); var contentService = GetRequiredService(); @@ -214,6 +228,14 @@ namespace Umbraco.Tests.Integration.TestServerTest.Controllers [Test] public async Task PostSave_Simple_Invariant() { + var localizationService = GetRequiredService(); + + //Add another language + localizationService.Save(new LanguageBuilder() + .WithCultureInfo("da-DK") + .WithIsDefault(false) + .Build()); + var url = PrepareUrl(x => x.PostSave(null)); var contentService = GetRequiredService(); @@ -270,6 +292,14 @@ namespace Umbraco.Tests.Integration.TestServerTest.Controllers [Test] public async Task PostSave_Validate_Empty_Name() { + var localizationService = GetRequiredService(); + + //Add another language + localizationService.Save(new LanguageBuilder() + .WithCultureInfo("da-DK") + .WithIsDefault(false) + .Build()); + var url = PrepareUrl(x => x.PostSave(null)); var contentService = GetRequiredService(); @@ -328,6 +358,14 @@ namespace Umbraco.Tests.Integration.TestServerTest.Controllers [Test] public async Task PostSave_Validate_Variants_Empty_Name() { + var localizationService = GetRequiredService(); + + //Add another language + localizationService.Save(new LanguageBuilder() + .WithCultureInfo("da-DK") + .WithIsDefault(false) + .Build()); + var url = PrepareUrl(x => x.PostSave(null)); var contentService = GetRequiredService(); @@ -383,9 +421,5 @@ namespace Umbraco.Tests.Integration.TestServerTest.Controllers } - - private class TestContentItemSave : ContentItemSave - { - } } }