From d77e198d3144f21eb48034eafd63b9c7b4251ba0 Mon Sep 17 00:00:00 2001 From: Mole Date: Tue, 21 Dec 2021 10:42:54 +0100 Subject: [PATCH] Move unit test to the new location --- .../Models/RequestHandlerSettingsTests.cs | 40 +++++++++---------- 1 file changed, 20 insertions(+), 20 deletions(-) rename {src => tests}/Umbraco.Tests.UnitTests/Umbraco.Core/Configuration/Models/RequestHandlerSettingsTests.cs (57%) diff --git a/src/Umbraco.Tests.UnitTests/Umbraco.Core/Configuration/Models/RequestHandlerSettingsTests.cs b/tests/Umbraco.Tests.UnitTests/Umbraco.Core/Configuration/Models/RequestHandlerSettingsTests.cs similarity index 57% rename from src/Umbraco.Tests.UnitTests/Umbraco.Core/Configuration/Models/RequestHandlerSettingsTests.cs rename to tests/Umbraco.Tests.UnitTests/Umbraco.Core/Configuration/Models/RequestHandlerSettingsTests.cs index c16d9b4897..9f2368d462 100644 --- a/src/Umbraco.Tests.UnitTests/Umbraco.Core/Configuration/Models/RequestHandlerSettingsTests.cs +++ b/tests/Umbraco.Tests.UnitTests/Umbraco.Core/Configuration/Models/RequestHandlerSettingsTests.cs @@ -11,7 +11,7 @@ namespace Umbraco.Cms.Tests.UnitTests.Umbraco.Core.Configuration.Models [Test] public void Given_CharCollection_With_DefaultEnabled_MergesCollection() { - var userCollection = new CharacterReplacement[] + var userCollection = new CharItem[] { new() { Char = "test", Replacement = "replace" }, new() { Char = "test2", Replacement = "replace2" } @@ -31,10 +31,10 @@ namespace Umbraco.Cms.Tests.UnitTests.Umbraco.Core.Configuration.Models [Test] public void Given_CharCollection_With_DefaultDisabled_ReturnsUserCollection() { - var userCollection = new CharacterReplacement[] + var userCollection = new CharItem[] { - new() { Char = "test", Replacement = "replace" }, - new() { Char = "test2", Replacement = "replace2" } + new () { Char = "test", Replacement = "replace" }, + new () { Char = "test2", Replacement = "replace2" } }; var settings = new RequestHandlerSettings { CharCollection = userCollection, EnableDefaultCharReplacements = false }; @@ -47,10 +47,10 @@ namespace Umbraco.Cms.Tests.UnitTests.Umbraco.Core.Configuration.Models [Test] public void Given_CharCollection_That_OverridesDefaultValues_ReturnsReplacements() { - var userCollection = new CharacterReplacement[] + var userCollection = new CharItem[] { - new() { Char = "%", Replacement = "percent" }, - new() { Char = ".", Replacement = "dot" } + new () { Char = "%", Replacement = "percent" }, + new () { Char = ".", Replacement = "dot" } }; var settings = new RequestHandlerSettings { CharCollection = userCollection }; @@ -58,20 +58,20 @@ namespace Umbraco.Cms.Tests.UnitTests.Umbraco.Core.Configuration.Models Assert.AreEqual(RequestHandlerSettings.DefaultCharCollection.Length, actual.Count); - Assert.That(actual, Has.Exactly(1).Matches(x => x.Char == "%" && x.Replacement == "percent")); - Assert.That(actual, Has.Exactly(1).Matches(x => x.Char == "." && x.Replacement == "dot")); - Assert.That(actual, Has.Exactly(0).Matches(x => x.Char == "%" && x.Replacement == string.Empty)); - Assert.That(actual, Has.Exactly(0).Matches(x => x.Char == "." && x.Replacement == string.Empty)); + Assert.That(actual, Has.Exactly(1).Matches(x => x.Char == "%" && x.Replacement == "percent")); + Assert.That(actual, Has.Exactly(1).Matches(x => x.Char == "." && x.Replacement == "dot")); + Assert.That(actual, Has.Exactly(0).Matches(x => x.Char == "%" && x.Replacement == string.Empty)); + Assert.That(actual, Has.Exactly(0).Matches(x => x.Char == "." && x.Replacement == string.Empty)); } [Test] public void Given_CharCollection_That_OverridesDefaultValues_And_ContainsNew_ReturnsMergedWithReplacements() { - var userCollection = new CharacterReplacement[] + var userCollection = new CharItem[] { - new() { Char = "%", Replacement = "percent" }, - new() { Char = ".", Replacement = "dot" }, - new() {Char = "new", Replacement = "new"} + new () { Char = "%", Replacement = "percent" }, + new () { Char = ".", Replacement = "dot" }, + new () { Char = "new", Replacement = "new" } }; var settings = new RequestHandlerSettings { CharCollection = userCollection }; @@ -80,11 +80,11 @@ namespace Umbraco.Cms.Tests.UnitTests.Umbraco.Core.Configuration.Models // Add 1 to the length, because we're expecting to only add one new one Assert.AreEqual(RequestHandlerSettings.DefaultCharCollection.Length + 1, actual.Count); - Assert.That(actual, Has.Exactly(1).Matches(x => x.Char == "%" && x.Replacement == "percent")); - Assert.That(actual, Has.Exactly(1).Matches(x => x.Char == "." && x.Replacement == "dot")); - Assert.That(actual, Has.Exactly(1).Matches(x => x.Char == "new" && x.Replacement == "new")); - Assert.That(actual, Has.Exactly(0).Matches(x => x.Char == "%" && x.Replacement == string.Empty)); - Assert.That(actual, Has.Exactly(0).Matches(x => x.Char == "." && x.Replacement == string.Empty)); + Assert.That(actual, Has.Exactly(1).Matches(x => x.Char == "%" && x.Replacement == "percent")); + Assert.That(actual, Has.Exactly(1).Matches(x => x.Char == "." && x.Replacement == "dot")); + Assert.That(actual, Has.Exactly(1).Matches(x => x.Char == "new" && x.Replacement == "new")); + Assert.That(actual, Has.Exactly(0).Matches(x => x.Char == "%" && x.Replacement == string.Empty)); + Assert.That(actual, Has.Exactly(0).Matches(x => x.Char == "." && x.Replacement == string.Empty)); } } }