diff --git a/src/Umbraco.Tests.UnitTests/Umbraco.Core/Configuration/Models/Extensions/HealthCheckSettingsExtensionsTests.cs b/src/Umbraco.Tests.UnitTests/Umbraco.Core/Configuration/Models/Extensions/HealthCheckSettingsExtensionsTests.cs index 833e5c865b..5bc14b3792 100644 --- a/src/Umbraco.Tests.UnitTests/Umbraco.Core/Configuration/Models/Extensions/HealthCheckSettingsExtensionsTests.cs +++ b/src/Umbraco.Tests.UnitTests/Umbraco.Core/Configuration/Models/Extensions/HealthCheckSettingsExtensionsTests.cs @@ -1,4 +1,7 @@ -using System; +// Copyright (c) Umbraco. +// See LICENSE for more details. + +using System; using NUnit.Framework; using Umbraco.Core.Configuration; using Umbraco.Core.Configuration.Models; @@ -12,10 +15,10 @@ namespace Umbraco.Tests.UnitTests.Umbraco.Core.Configuration.Models.Extensions private ICronTabParser CronTabParser => new NCronTabParser(); [TestCase("30 12 * * *", 30)] - [TestCase("15 18 * * *", 60 * 6 + 15)] + [TestCase("15 18 * * *", (60 * 6) + 15)] [TestCase("0 3 * * *", 60 * 15)] - [TestCase("0 3 2 * *", 24 * 60 * 1 + 60 * 15)] - [TestCase("0 6 * * 3", 24 * 60 * 3 + 60 * 18)] + [TestCase("0 3 2 * *", (24 * 60 * 1) + (60 * 15))] + [TestCase("0 6 * * 3", (24 * 60 * 3) + (60 * 18))] public void Returns_Notification_Delay_From_Provided_Time(string firstRunTimeCronExpression, int expectedDelayInMinutes) { var settings = new HealthChecksSettings @@ -26,7 +29,7 @@ namespace Umbraco.Tests.UnitTests.Umbraco.Core.Configuration.Models.Extensions } }; var now = new DateTime(2020, 10, 31, 12, 0, 0); - var result = settings.GetNotificationDelay(CronTabParser, now, TimeSpan.Zero); + TimeSpan result = settings.GetNotificationDelay(CronTabParser, now, TimeSpan.Zero); Assert.AreEqual(expectedDelayInMinutes, result.TotalMinutes); } @@ -41,7 +44,7 @@ namespace Umbraco.Tests.UnitTests.Umbraco.Core.Configuration.Models.Extensions } }; var now = new DateTime(2020, 10, 31, 12, 25, 0); - var result = settings.GetNotificationDelay(CronTabParser, now, TimeSpan.FromMinutes(10)); + TimeSpan result = settings.GetNotificationDelay(CronTabParser, now, TimeSpan.FromMinutes(10)); Assert.AreEqual(10, result.TotalMinutes); } } diff --git a/src/Umbraco.Tests.UnitTests/Umbraco.Core/Configuration/Models/Validation/ContentSettingsValidatorTests.cs b/src/Umbraco.Tests.UnitTests/Umbraco.Core/Configuration/Models/Validation/ContentSettingsValidatorTests.cs index 31f6f5e31c..ded3f1c725 100644 --- a/src/Umbraco.Tests.UnitTests/Umbraco.Core/Configuration/Models/Validation/ContentSettingsValidatorTests.cs +++ b/src/Umbraco.Tests.UnitTests/Umbraco.Core/Configuration/Models/Validation/ContentSettingsValidatorTests.cs @@ -1,18 +1,22 @@ -using NUnit.Framework; +// Copyright (c) Umbraco. +// See LICENSE for more details. + +using Microsoft.Extensions.Options; +using NUnit.Framework; using Umbraco.Core.Configuration.Models; using Umbraco.Core.Configuration.Models.Validation; namespace Umbraco.Tests.UnitTests.Umbraco.Core.Configuration.Models.Validation { [TestFixture] - public class ContentSettingsValidationTests + public class ContentSettingsValidatorTests { [Test] public void Returns_Success_ForValid_Configuration() { var validator = new ContentSettingsValidator(); - var options = BuildContentSettings(); - var result = validator.Validate("settings", options); + ContentSettings options = BuildContentSettings(); + ValidateOptionsResult result = validator.Validate("settings", options); Assert.True(result.Succeeded); } @@ -20,8 +24,8 @@ namespace Umbraco.Tests.UnitTests.Umbraco.Core.Configuration.Models.Validation public void Returns_Fail_For_Configuration_With_Invalid_Error404Collection_Due_To_Duplicate_Id() { var validator = new ContentSettingsValidator(); - var options = BuildContentSettings(contentXPath: "/aaa/bbb"); - var result = validator.Validate("settings", options); + ContentSettings options = BuildContentSettings(contentXPath: "/aaa/bbb"); + ValidateOptionsResult result = validator.Validate("settings", options); Assert.False(result.Succeeded); } @@ -29,8 +33,8 @@ namespace Umbraco.Tests.UnitTests.Umbraco.Core.Configuration.Models.Validation public void Returns_Fail_For_Configuration_With_Invalid_Error404Collection_Due_To_Empty_Culture() { var validator = new ContentSettingsValidator(); - var options = BuildContentSettings(culture: string.Empty); - var result = validator.Validate("settings", options); + ContentSettings options = BuildContentSettings(culture: string.Empty); + ValidateOptionsResult result = validator.Validate("settings", options); Assert.False(result.Succeeded); } @@ -38,27 +42,25 @@ namespace Umbraco.Tests.UnitTests.Umbraco.Core.Configuration.Models.Validation public void Returns_Fail_For_Configuration_With_Invalid_AutoFillImageProperties_Collection() { var validator = new ContentSettingsValidator(); - var options = BuildContentSettings(culture: string.Empty); - var result = validator.Validate("settings", options); + ContentSettings options = BuildContentSettings(culture: string.Empty); + ValidateOptionsResult result = validator.Validate("settings", options); Assert.False(result.Succeeded); } - private static ContentSettings BuildContentSettings(string culture = "en-US", string contentXPath = "", string autoFillImagePropertyAlias = "testAlias") - { - return new ContentSettings + private static ContentSettings BuildContentSettings(string culture = "en-US", string contentXPath = "", string autoFillImagePropertyAlias = "testAlias") => + new ContentSettings { Error404Collection = new ContentErrorPage[] - { - new ContentErrorPage { Culture = culture, ContentId = 1, ContentXPath = contentXPath }, - }, + { + new ContentErrorPage { Culture = culture, ContentId = 1, ContentXPath = contentXPath }, + }, Imaging = new ContentImagingSettings { AutoFillImageProperties = new ImagingAutoFillUploadField[] - { - new ImagingAutoFillUploadField { Alias = autoFillImagePropertyAlias, WidthFieldAlias = "w", HeightFieldAlias = "h", LengthFieldAlias = "l", ExtensionFieldAlias = "e" } - } + { + new ImagingAutoFillUploadField { Alias = autoFillImagePropertyAlias, WidthFieldAlias = "w", HeightFieldAlias = "h", LengthFieldAlias = "l", ExtensionFieldAlias = "e" } + } } }; - } } }