From bceab79ed2d5227c1ca8c5039c588feba5e26338 Mon Sep 17 00:00:00 2001 From: Paul Johnson Date: Tue, 12 Oct 2021 10:15:52 +0100 Subject: [PATCH] Fix broken tests. --- .../DependencyInjection/UmbracoBuilderExtensions.cs | 9 ++++----- .../Umbraco.Web.Common/FileNameTests.cs | 4 ++-- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/tests/Umbraco.Tests.Integration/DependencyInjection/UmbracoBuilderExtensions.cs b/tests/Umbraco.Tests.Integration/DependencyInjection/UmbracoBuilderExtensions.cs index 1d7142d270df..7bf435485f39 100644 --- a/tests/Umbraco.Tests.Integration/DependencyInjection/UmbracoBuilderExtensions.cs +++ b/tests/Umbraco.Tests.Integration/DependencyInjection/UmbracoBuilderExtensions.cs @@ -79,11 +79,10 @@ private static ILocalizedTextService GetLocalizedTextService(IServiceProvider fa new Lazy(() => { // get the src folder - var currFolder = new DirectoryInfo(TestContext.CurrentContext.TestDirectory); - while (!currFolder.Name.Equals("src", StringComparison.InvariantCultureIgnoreCase)) - { - currFolder = currFolder.Parent; - } + var root = TestContext.CurrentContext.TestDirectory.Split("tests")[0]; + var srcFolder = Path.Combine(root, "src"); + + var currFolder = new DirectoryInfo(srcFolder); DirectoryInfo uiProject = currFolder.GetDirectories("Umbraco.Web.UI", SearchOption.TopDirectoryOnly).First(); var mainLangFolder = new DirectoryInfo(Path.Combine(uiProject.FullName, globalSettings.Value.UmbracoPath.TrimStart("~/"), "config", "lang")); diff --git a/tests/Umbraco.Tests.UnitTests/Umbraco.Web.Common/FileNameTests.cs b/tests/Umbraco.Tests.UnitTests/Umbraco.Web.Common/FileNameTests.cs index 58cce954868f..2bf1dcb5c764 100644 --- a/tests/Umbraco.Tests.UnitTests/Umbraco.Web.Common/FileNameTests.cs +++ b/tests/Umbraco.Tests.UnitTests/Umbraco.Web.Common/FileNameTests.cs @@ -32,8 +32,8 @@ private string GetViewName(ViewResult viewResult, string separator = "/") private IEnumerable GetUiFiles(IEnumerable pathFromNetCore) { - var sourceRoot = TestContext.CurrentContext.TestDirectory.Split("Umbraco.Tests.UnitTests")[0]; - var pathToFiles = Path.Combine(sourceRoot, "Umbraco.Web.UI"); + var root = TestContext.CurrentContext.TestDirectory.Split("tests")[0]; + var pathToFiles = Path.Combine(root, "src", "Umbraco.Web.UI"); foreach (var pathSection in pathFromNetCore) { pathToFiles = Path.Combine(pathToFiles, pathSection);