2020-12-20 08:36:11 +01:00
|
|
|
// Copyright (c) Umbraco.
|
|
|
|
|
// See LICENSE for more details.
|
|
|
|
|
|
|
|
|
|
using AutoFixture.NUnit3;
|
2020-09-28 12:51:12 +02:00
|
|
|
using Microsoft.Extensions.Options;
|
|
|
|
|
using NUnit.Framework;
|
2021-02-18 11:06:02 +01:00
|
|
|
using Umbraco.Cms.Core.Configuration.Models;
|
|
|
|
|
using Umbraco.Cms.Tests.UnitTests.AutoFixture;
|
|
|
|
|
using Umbraco.Cms.Web.Common.AspNetCore;
|
|
|
|
|
using Umbraco.Extensions;
|
2020-09-28 12:51:12 +02:00
|
|
|
|
2022-06-21 08:09:38 +02:00
|
|
|
namespace Umbraco.Cms.Tests.UnitTests.Umbraco.Core.Configuration.Models;
|
|
|
|
|
|
|
|
|
|
[TestFixture]
|
|
|
|
|
public class GlobalSettingsTests
|
2020-09-28 12:51:12 +02:00
|
|
|
{
|
2022-06-21 08:09:38 +02:00
|
|
|
[InlineAutoMoqData("~/umbraco", "/", "umbraco")]
|
|
|
|
|
[InlineAutoMoqData("~/umbraco", "/MyVirtualDir", "umbraco")]
|
|
|
|
|
[InlineAutoMoqData("~/customPath", "/MyVirtualDir/", "custompath")]
|
|
|
|
|
[InlineAutoMoqData("~/some-wacky/nestedPath", "/MyVirtualDir", "some-wacky-nestedpath")]
|
|
|
|
|
[InlineAutoMoqData("~/some-wacky/nestedPath", "/MyVirtualDir/NestedVDir/", "some-wacky-nestedpath")]
|
|
|
|
|
public void Umbraco_Mvc_Area(
|
|
|
|
|
string path,
|
|
|
|
|
string rootPath,
|
|
|
|
|
string outcome,
|
|
|
|
|
[Frozen] IOptionsMonitor<HostingSettings> hostingSettings,
|
|
|
|
|
AspNetCoreHostingEnvironment hostingEnvironment)
|
2020-09-28 12:51:12 +02:00
|
|
|
{
|
2022-06-21 08:09:38 +02:00
|
|
|
hostingSettings.CurrentValue.ApplicationVirtualPath = rootPath;
|
2020-09-28 12:51:12 +02:00
|
|
|
|
2022-06-21 08:09:38 +02:00
|
|
|
var globalSettings = new GlobalSettings { UmbracoPath = path };
|
2020-09-28 12:51:12 +02:00
|
|
|
|
2022-06-21 08:09:38 +02:00
|
|
|
Assert.AreEqual(outcome, globalSettings.GetUmbracoMvcAreaNoCache(hostingEnvironment));
|
2020-09-28 12:51:12 +02:00
|
|
|
}
|
|
|
|
|
}
|