Migrated more tests + Aligned IHostingEnvironment.ToAbsolute implementation with expectations from old tests
This commit is contained in:
@@ -1,5 +0,0 @@
|
||||
@using Umbraco.Web.PublishedModels;
|
||||
@inherits Umbraco.Web.Common.AspNetCore.UmbracoViewPage
|
||||
@{
|
||||
Layout = null;
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
@using Umbraco.Web.PublishedModels;
|
||||
@inherits Umbraco.Web.Common.AspNetCore.UmbracoViewPage
|
||||
@{
|
||||
Layout = null;
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
@using Umbraco.Web.PublishedModels;
|
||||
@inherits Umbraco.Web.Common.AspNetCore.UmbracoViewPage
|
||||
@{
|
||||
Layout = null;
|
||||
}
|
||||
@@ -6,6 +6,7 @@ using System.IO;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Threading;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using Moq;
|
||||
using NUnit.Framework;
|
||||
using Umbraco.Core;
|
||||
@@ -30,6 +31,8 @@ using Umbraco.Web.Routing;
|
||||
using File = System.IO.File;
|
||||
using Microsoft.Extensions.Options;
|
||||
using Umbraco.Core.Configuration.Models;
|
||||
using Umbraco.Web.Common.AspNetCore;
|
||||
using IHostingEnvironment = Umbraco.Core.Hosting.IHostingEnvironment;
|
||||
|
||||
namespace Umbraco.Tests.TestHelpers
|
||||
{
|
||||
@@ -58,7 +61,11 @@ namespace Umbraco.Tests.TestHelpers
|
||||
=> Mock.Of<IBackOfficeInfo>();
|
||||
|
||||
public override IHostingEnvironment GetHostingEnvironment()
|
||||
=> Mock.Of<IHostingEnvironment>();
|
||||
{
|
||||
return new AspNetCoreHostingEnvironment(
|
||||
Mock.Of<IOptionsMonitor<HostingSettings>>(x=>x.CurrentValue == new HostingSettings()),
|
||||
Mock.Of<IWebHostEnvironment>(x=>x.WebRootPath == "/"));
|
||||
}
|
||||
|
||||
public override IApplicationShutdownRegistry GetHostingEnvironmentLifetime()
|
||||
=> Mock.Of<IApplicationShutdownRegistry>();
|
||||
@@ -308,7 +315,7 @@ namespace Umbraco.Tests.TestHelpers
|
||||
public static IIpResolver GetIpResolver() => _testHelperInternal.GetIpResolver();
|
||||
|
||||
public static IRequestCache GetRequestCache() => _testHelperInternal.GetRequestCache();
|
||||
|
||||
|
||||
public static IPublishedUrlProvider GetPublishedUrlProvider() => _testHelperInternal.GetPublishedUrlProvider();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@ using Umbraco.Core.PropertyEditors;
|
||||
using Umbraco.Core.PropertyEditors.Validators;
|
||||
using Umbraco.Core.Services;
|
||||
using Umbraco.Core.Dashboards;
|
||||
using Umbraco.Core.IO;
|
||||
using Umbraco.Core.Serialization;
|
||||
using Umbraco.Core.Strings;
|
||||
using Umbraco.Tests.TestHelpers;
|
||||
@@ -22,6 +23,7 @@ namespace Umbraco.Tests.Manifest
|
||||
public class ManifestParserTests
|
||||
{
|
||||
private ManifestParser _parser;
|
||||
private IIOHelper _ioHelper;
|
||||
|
||||
[SetUp]
|
||||
public void Setup()
|
||||
@@ -32,7 +34,8 @@ namespace Umbraco.Tests.Manifest
|
||||
new RegexValidator(Mock.Of<ILocalizedTextService>(), null),
|
||||
new DelimitedValueValidator(),
|
||||
};
|
||||
_parser = new ManifestParser(AppCaches.Disabled, new ManifestValueValidatorCollection(validators), new ManifestFilterCollection(Array.Empty<IManifestFilter>()), Mock.Of<ILogger>(), TestHelper.IOHelper, Mock.Of<IDataTypeService>(), Mock.Of<ILocalizationService>(), new JsonNetSerializer(), Mock.Of<ILocalizedTextService>(), Mock.Of<IShortStringHelper>());
|
||||
_ioHelper = TestHelper.IOHelper;
|
||||
_parser = new ManifestParser(AppCaches.Disabled, new ManifestValueValidatorCollection(validators), new ManifestFilterCollection(Array.Empty<IManifestFilter>()), Mock.Of<ILogger>(), _ioHelper, Mock.Of<IDataTypeService>(), Mock.Of<ILocalizationService>(), new JsonNetSerializer(), Mock.Of<ILocalizedTextService>(), Mock.Of<IShortStringHelper>());
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -125,8 +128,8 @@ javascript: ['~/test.js',/*** some note about stuff asd09823-4**09234*/ '~/test2
|
||||
manifest = _parser.ParseManifest(json);
|
||||
Assert.AreEqual(2, manifest.Scripts.Length);
|
||||
|
||||
Assert.AreEqual("/test.js", manifest.Scripts[0]);
|
||||
Assert.AreEqual("/test2.js", manifest.Scripts[1]);
|
||||
Assert.AreEqual(_ioHelper.ResolveUrl("/test.js"), manifest.Scripts[0]);
|
||||
Assert.AreEqual(_ioHelper.ResolveUrl("/test2.js"), manifest.Scripts[1]);
|
||||
|
||||
// kludge is gone - must filter before parsing
|
||||
json = Encoding.UTF8.GetString(Encoding.UTF8.GetPreamble()) + "{propertyEditors: [], javascript: ['~/test.js', '~/test2.js']}";
|
||||
@@ -218,7 +221,7 @@ javascript: ['~/test.js',/*** some note about stuff asd09823-4**09234*/ '~/test2
|
||||
Assert.IsFalse((editor.Type & EditorType.MacroParameter) > 0);
|
||||
|
||||
var valueEditor = editor.GetValueEditor();
|
||||
Assert.AreEqual("/App_Plugins/MyPackage/PropertyEditors/MyEditor.html", valueEditor.View);
|
||||
Assert.AreEqual(_ioHelper.ResolveUrl("/App_Plugins/MyPackage/PropertyEditors/MyEditor.html"), valueEditor.View);
|
||||
Assert.AreEqual("int", valueEditor.ValueType);
|
||||
Assert.IsTrue(valueEditor.HideLabel);
|
||||
|
||||
@@ -250,7 +253,7 @@ javascript: ['~/test.js',/*** some note about stuff asd09823-4**09234*/ '~/test2
|
||||
var f = preValueEditor.Fields[0];
|
||||
Assert.AreEqual("key1", f.Key);
|
||||
Assert.AreEqual("Some config 1", f.Name);
|
||||
Assert.AreEqual("/App_Plugins/MyPackage/PropertyEditors/Views/pre-val1.html", f.View);
|
||||
Assert.AreEqual(_ioHelper.ResolveUrl("/App_Plugins/MyPackage/PropertyEditors/Views/pre-val1.html"), f.View);
|
||||
var fvalidators = f.Validators;
|
||||
Assert.IsNotNull(fvalidators);
|
||||
Assert.AreEqual(1, fvalidators.Count);
|
||||
@@ -261,7 +264,7 @@ javascript: ['~/test.js',/*** some note about stuff asd09823-4**09234*/ '~/test2
|
||||
f = preValueEditor.Fields[1];
|
||||
Assert.AreEqual("key2", f.Key);
|
||||
Assert.AreEqual("Some config 2", f.Name);
|
||||
Assert.AreEqual("/App_Plugins/MyPackage/PropertyEditors/Views/pre-val2.html", f.View);
|
||||
Assert.AreEqual(_ioHelper.ResolveUrl("/App_Plugins/MyPackage/PropertyEditors/Views/pre-val2.html"), f.View);
|
||||
fvalidators = f.Validators;
|
||||
Assert.IsNotNull(fvalidators);
|
||||
Assert.AreEqual(0, fvalidators.Count);
|
||||
@@ -303,7 +306,7 @@ javascript: ['~/test.js',/*** some note about stuff asd09823-4**09234*/ '~/test2
|
||||
Assert.AreEqual("some config val", config["key1"]);
|
||||
|
||||
var valueEditor = editor.GetValueEditor();
|
||||
Assert.AreEqual("/App_Plugins/MyPackage/PropertyEditors/CsvEditor.html", valueEditor.View);
|
||||
Assert.AreEqual(_ioHelper.ResolveUrl("/App_Plugins/MyPackage/PropertyEditors/CsvEditor.html"), valueEditor.View);
|
||||
|
||||
editor = manifest.ParameterEditors[2];
|
||||
Assert.Throws<InvalidOperationException>(() =>
|
||||
@@ -353,8 +356,8 @@ javascript: ['~/test.js',/*** some note about stuff asd09823-4**09234*/ '~/test2
|
||||
var editor = manifest.GridEditors[0];
|
||||
Assert.AreEqual("small-hero", editor.Alias);
|
||||
Assert.AreEqual("Small Hero", editor.Name);
|
||||
Assert.AreEqual("/App_Plugins/MyPlugin/small-hero/editortemplate.html", editor.View);
|
||||
Assert.AreEqual("/Views/Partials/Grid/Editors/SmallHero.cshtml", editor.Render);
|
||||
Assert.AreEqual(_ioHelper.ResolveUrl("/App_Plugins/MyPlugin/small-hero/editortemplate.html"), editor.View);
|
||||
Assert.AreEqual(_ioHelper.ResolveUrl("/Views/Partials/Grid/Editors/SmallHero.cshtml"), editor.Render);
|
||||
Assert.AreEqual("icon-presentation", editor.Icon);
|
||||
|
||||
var config = editor.Config;
|
||||
@@ -396,14 +399,14 @@ javascript: ['~/test.js',/*** some note about stuff asd09823-4**09234*/ '~/test2
|
||||
Assert.AreEqual("myPackageApp1", app0.Alias);
|
||||
Assert.AreEqual("My App1", app0.Name);
|
||||
Assert.AreEqual("icon-foo", app0.Icon);
|
||||
Assert.AreEqual("/App_Plugins/MyPackage/ContentApps/MyApp1.html", app0.View);
|
||||
Assert.AreEqual(_ioHelper.ResolveUrl("/App_Plugins/MyPackage/ContentApps/MyApp1.html"), app0.View);
|
||||
|
||||
Assert.IsInstanceOf<ManifestContentAppDefinition>(manifest.ContentApps[1]);
|
||||
var app1 = (ManifestContentAppDefinition)manifest.ContentApps[1];
|
||||
Assert.AreEqual("myPackageApp2", app1.Alias);
|
||||
Assert.AreEqual("My App2", app1.Name);
|
||||
Assert.AreEqual("icon-bar", app1.Icon);
|
||||
Assert.AreEqual("/App_Plugins/MyPackage/ContentApps/MyApp2.html", app1.View);
|
||||
Assert.AreEqual(_ioHelper.ResolveUrl("/App_Plugins/MyPackage/ContentApps/MyApp2.html"), app1.View);
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -432,7 +435,7 @@ javascript: ['~/test.js',/*** some note about stuff asd09823-4**09234*/ '~/test2
|
||||
var db0 = manifest.Dashboards[0];
|
||||
Assert.AreEqual("something", db0.Alias);
|
||||
Assert.AreEqual(100, db0.Weight);
|
||||
Assert.AreEqual("/App_Plugins/MyPackage/Dashboards/one.html", db0.View);
|
||||
Assert.AreEqual(_ioHelper.ResolveUrl("/App_Plugins/MyPackage/Dashboards/one.html"), db0.View);
|
||||
Assert.AreEqual(1, db0.Sections.Length);
|
||||
Assert.AreEqual("content", db0.Sections[0]);
|
||||
Assert.AreEqual(2, db0.AccessRules.Length);
|
||||
@@ -445,7 +448,7 @@ javascript: ['~/test.js',/*** some note about stuff asd09823-4**09234*/ '~/test2
|
||||
var db1 = manifest.Dashboards[1];
|
||||
Assert.AreEqual("something.else", db1.Alias);
|
||||
Assert.AreEqual(-1, db1.Weight);
|
||||
Assert.AreEqual("/App_Plugins/MyPackage/Dashboards/two.html", db1.View);
|
||||
Assert.AreEqual(_ioHelper.ResolveUrl("/App_Plugins/MyPackage/Dashboards/two.html"), db1.View);
|
||||
Assert.AreEqual(1, db1.Sections.Length);
|
||||
Assert.AreEqual("forms", db1.Sections[0]);
|
||||
}
|
||||
@@ -1,29 +1,34 @@
|
||||
using System;
|
||||
using AutoFixture.NUnit3;
|
||||
using Moq;
|
||||
using NUnit.Framework;
|
||||
using Umbraco.Core.Hosting;
|
||||
using Umbraco.Core.IO;
|
||||
using Umbraco.Core.Strings;
|
||||
using Umbraco.Tests.TestHelpers;
|
||||
using Umbraco.Tests.UnitTests.AutoFixture;
|
||||
using Umbraco.Web.Common.AspNetCore;
|
||||
|
||||
namespace Umbraco.Tests.IO
|
||||
{
|
||||
[TestFixture]
|
||||
public class IoHelperTests
|
||||
public class AspNetCoreHostingEnvironmentTests
|
||||
{
|
||||
private IIOHelper _ioHelper => TestHelper.IOHelper;
|
||||
|
||||
[TestCase("~/Scripts", "/Scripts", null)]
|
||||
[TestCase("/Scripts", "/Scripts", null)]
|
||||
[TestCase("../Scripts", "/Scripts", typeof(ArgumentException))]
|
||||
public void IOHelper_ResolveUrl(string input, string expected, Type expectedExceptionType)
|
||||
[InlineAutoMoqData("~/Scripts", "/Scripts", null)]
|
||||
[InlineAutoMoqData("/Scripts", "/Scripts", null)]
|
||||
[InlineAutoMoqData("../Scripts", "/Scripts", typeof(InvalidOperationException))]
|
||||
public void IOHelper_ResolveUrl(string input, string expected, Type expectedExceptionType, AspNetCoreHostingEnvironment sut)
|
||||
{
|
||||
|
||||
if (expectedExceptionType != null)
|
||||
{
|
||||
Assert.Throws(expectedExceptionType, () =>_ioHelper.ResolveUrl(input));
|
||||
Assert.Throws(expectedExceptionType, () =>sut.ToAbsolute(input));
|
||||
}
|
||||
else
|
||||
{
|
||||
var result = _ioHelper.ResolveUrl(input);
|
||||
|
||||
var result = sut.ToAbsolute(input);
|
||||
Assert.AreEqual(expected, result);
|
||||
}
|
||||
}
|
||||
@@ -13,7 +13,6 @@ using Umbraco.Core.IO.MediaPathSchemes;
|
||||
using Umbraco.Core.Logging;
|
||||
using Umbraco.Core.Services;
|
||||
using Umbraco.Tests.TestHelpers;
|
||||
using Current = Umbraco.Web.Composing.Current;
|
||||
using FileSystems = Umbraco.Core.IO.FileSystems;
|
||||
|
||||
namespace Umbraco.Tests.IO
|
||||
@@ -46,9 +45,6 @@ namespace Umbraco.Tests.IO
|
||||
|
||||
_factory = composition.CreateFactory();
|
||||
|
||||
Current.Reset();
|
||||
Current.Factory = _factory;
|
||||
|
||||
// make sure we start clean
|
||||
// because some tests will create corrupt or weird filesystems
|
||||
FileSystems.Reset();
|
||||
@@ -60,7 +56,6 @@ namespace Umbraco.Tests.IO
|
||||
// stay clean (see note in Setup)
|
||||
FileSystems.Reset();
|
||||
|
||||
Current.Reset();
|
||||
_register.DisposeIfDisposable();
|
||||
}
|
||||
|
||||
@@ -115,7 +110,7 @@ namespace Umbraco.Tests.IO
|
||||
fs.DeleteMediaFiles(new[] { virtPath });
|
||||
Assert.IsFalse(File.Exists(physPath));
|
||||
|
||||
var scheme = Current.Factory.GetInstance<IMediaPathScheme>();
|
||||
var scheme = _factory.GetInstance<IMediaPathScheme>();
|
||||
if (scheme is UniqueMediaPathScheme)
|
||||
{
|
||||
// ~/media/1234 is *not* gone
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
@@ -11,9 +10,8 @@ using Umbraco.Core.Composing;
|
||||
using Umbraco.Core.Configuration.Models;
|
||||
using Umbraco.Core.IO;
|
||||
using Umbraco.Core.Logging;
|
||||
using Umbraco.Core.Scoping;
|
||||
using Umbraco.Tests.Common.Builders;
|
||||
using Umbraco.Tests.TestHelpers;
|
||||
using IHostingEnvironment = Umbraco.Core.Hosting.IHostingEnvironment;
|
||||
|
||||
namespace Umbraco.Tests.IO
|
||||
{
|
||||
@@ -25,11 +23,15 @@ namespace Umbraco.Tests.IO
|
||||
// SetUp and TearDown run before/after each test
|
||||
// SetUp does not start before the previous TearDown returns
|
||||
|
||||
private readonly ILogger _logger = Mock.Of<ILogger>();
|
||||
private readonly IHostingEnvironment _hostingEnvironment = TestHelper.GetHostingEnvironment();
|
||||
private readonly IIOHelper _ioHelper = TestHelper.IOHelper;
|
||||
|
||||
[SetUp]
|
||||
public void SetUp()
|
||||
{
|
||||
SafeCallContext.Clear();
|
||||
ClearFiles(TestHelper.IOHelper);
|
||||
ClearFiles(_ioHelper);
|
||||
FileSystems.ResetShadowId();
|
||||
}
|
||||
|
||||
@@ -41,10 +43,10 @@ namespace Umbraco.Tests.IO
|
||||
FileSystems.ResetShadowId();
|
||||
}
|
||||
|
||||
private static void ClearFiles(IIOHelper ioHelper)
|
||||
private static void ClearFiles(IIOHelper _ioHelper)
|
||||
{
|
||||
TestHelper.DeleteDirectory(ioHelper.MapPath("FileSysTests"));
|
||||
TestHelper.DeleteDirectory(ioHelper.MapPath(Constants.SystemDirectories.TempData.EnsureEndsWith('/') + "ShadowFs"));
|
||||
TestHelper.DeleteDirectory(_ioHelper.MapPath("FileSysTests"));
|
||||
TestHelper.DeleteDirectory(_ioHelper.MapPath(Constants.SystemDirectories.TempData.EnsureEndsWith('/') + "ShadowFs"));
|
||||
}
|
||||
|
||||
private static string NormPath(string path)
|
||||
@@ -55,17 +57,13 @@ namespace Umbraco.Tests.IO
|
||||
[Test]
|
||||
public void ShadowDeleteDirectory()
|
||||
{
|
||||
var ioHelper = TestHelper.IOHelper;
|
||||
var logger = Mock.Of<ILogger>();
|
||||
var hostingEnvironment = TestHelper.GetHostingEnvironment();
|
||||
|
||||
var path = ioHelper.MapPath("FileSysTests");
|
||||
var path = _ioHelper.MapPath("FileSysTests");
|
||||
Directory.CreateDirectory(path);
|
||||
Directory.CreateDirectory(path + "/ShadowTests");
|
||||
Directory.CreateDirectory(path + "/ShadowSystem");
|
||||
|
||||
var fs = new PhysicalFileSystem(ioHelper, hostingEnvironment, logger, path + "/ShadowTests/", "ignore");
|
||||
var sfs = new PhysicalFileSystem(ioHelper, hostingEnvironment, logger, path + "/ShadowSystem/", "ignore");
|
||||
var fs = new PhysicalFileSystem(_ioHelper, _hostingEnvironment, _logger, path + "/ShadowTests/", "ignore");
|
||||
var sfs = new PhysicalFileSystem(_ioHelper, _hostingEnvironment, _logger, path + "/ShadowSystem/", "ignore");
|
||||
var ss = new ShadowFileSystem(fs, sfs);
|
||||
|
||||
Directory.CreateDirectory(path + "/ShadowTests/d1");
|
||||
@@ -93,17 +91,13 @@ namespace Umbraco.Tests.IO
|
||||
[Test]
|
||||
public void ShadowDeleteDirectoryInDir()
|
||||
{
|
||||
var ioHelper = TestHelper.IOHelper;
|
||||
var logger = Mock.Of<ILogger>();
|
||||
var hostingEnvironment = TestHelper.GetHostingEnvironment();
|
||||
|
||||
var path = ioHelper.MapPath("FileSysTests");
|
||||
var path = _ioHelper.MapPath("FileSysTests");
|
||||
Directory.CreateDirectory(path);
|
||||
Directory.CreateDirectory(path + "/ShadowTests");
|
||||
Directory.CreateDirectory(path + "/ShadowSystem");
|
||||
|
||||
var fs = new PhysicalFileSystem(ioHelper, hostingEnvironment, logger, path + "/ShadowTests/", "ignore");
|
||||
var sfs = new PhysicalFileSystem(ioHelper, hostingEnvironment, logger, path + "/ShadowSystem/", "ignore");
|
||||
var fs = new PhysicalFileSystem(_ioHelper, _hostingEnvironment, _logger, path + "/ShadowTests/", "ignore");
|
||||
var sfs = new PhysicalFileSystem(_ioHelper, _hostingEnvironment, _logger, path + "/ShadowSystem/", "ignore");
|
||||
var ss = new ShadowFileSystem(fs, sfs);
|
||||
|
||||
Directory.CreateDirectory(path + "/ShadowTests/sub");
|
||||
@@ -146,17 +140,13 @@ namespace Umbraco.Tests.IO
|
||||
[Test]
|
||||
public void ShadowDeleteFile()
|
||||
{
|
||||
var ioHelper = TestHelper.IOHelper;
|
||||
var logger = Mock.Of<ILogger>();
|
||||
var hostingEnvironment = TestHelper.GetHostingEnvironment();
|
||||
|
||||
var path = ioHelper.MapPath("FileSysTests");
|
||||
var path = _ioHelper.MapPath("FileSysTests");
|
||||
Directory.CreateDirectory(path);
|
||||
Directory.CreateDirectory(path + "/ShadowTests");
|
||||
Directory.CreateDirectory(path + "/ShadowSystem");
|
||||
|
||||
var fs = new PhysicalFileSystem(ioHelper, hostingEnvironment, logger, path + "/ShadowTests/", "ignore");
|
||||
var sfs = new PhysicalFileSystem(ioHelper, hostingEnvironment, logger, path + "/ShadowSystem/", "ignore");
|
||||
var fs = new PhysicalFileSystem(_ioHelper, _hostingEnvironment, _logger, path + "/ShadowTests/", "ignore");
|
||||
var sfs = new PhysicalFileSystem(_ioHelper, _hostingEnvironment, _logger, path + "/ShadowSystem/", "ignore");
|
||||
var ss = new ShadowFileSystem(fs, sfs);
|
||||
|
||||
File.WriteAllText(path + "/ShadowTests/f1.txt", "foo");
|
||||
@@ -189,18 +179,14 @@ namespace Umbraco.Tests.IO
|
||||
[Test]
|
||||
public void ShadowDeleteFileInDir()
|
||||
{
|
||||
var ioHelper = TestHelper.IOHelper;
|
||||
var logger = Mock.Of<ILogger>();
|
||||
var hostingEnvironment = TestHelper.GetHostingEnvironment();
|
||||
|
||||
var path = ioHelper.MapPath("FileSysTests");
|
||||
var path = _ioHelper.MapPath("FileSysTests");
|
||||
|
||||
Directory.CreateDirectory(path);
|
||||
Directory.CreateDirectory(path + "/ShadowTests");
|
||||
Directory.CreateDirectory(path + "/ShadowSystem");
|
||||
|
||||
var fs = new PhysicalFileSystem(ioHelper, hostingEnvironment, logger, path + "/ShadowTests/", "ignore");
|
||||
var sfs = new PhysicalFileSystem(ioHelper, hostingEnvironment, logger, path + "/ShadowSystem/", "ignore");
|
||||
var fs = new PhysicalFileSystem(_ioHelper, _hostingEnvironment, _logger, path + "/ShadowTests/", "ignore");
|
||||
var sfs = new PhysicalFileSystem(_ioHelper, _hostingEnvironment, _logger, path + "/ShadowSystem/", "ignore");
|
||||
var ss = new ShadowFileSystem(fs, sfs);
|
||||
|
||||
Directory.CreateDirectory(path + "/ShadowTests/sub");
|
||||
@@ -249,17 +235,13 @@ namespace Umbraco.Tests.IO
|
||||
[Test]
|
||||
public void ShadowCantCreateFile()
|
||||
{
|
||||
var ioHelper = TestHelper.IOHelper;
|
||||
var logger = Mock.Of<ILogger>();
|
||||
var hostingEnvironment = TestHelper.GetHostingEnvironment();
|
||||
|
||||
var path = ioHelper.MapPath("FileSysTests");
|
||||
var path = _ioHelper.MapPath("FileSysTests");
|
||||
Directory.CreateDirectory(path);
|
||||
Directory.CreateDirectory(path + "/ShadowTests");
|
||||
Directory.CreateDirectory(path + "/ShadowSystem");
|
||||
|
||||
var fs = new PhysicalFileSystem(ioHelper, hostingEnvironment, logger, path + "/ShadowTests/", "ignore");
|
||||
var sfs = new PhysicalFileSystem(ioHelper, hostingEnvironment, logger, path + "/ShadowSystem/", "ignore");
|
||||
var fs = new PhysicalFileSystem(_ioHelper, _hostingEnvironment, _logger, path + "/ShadowTests/", "ignore");
|
||||
var sfs = new PhysicalFileSystem(_ioHelper, _hostingEnvironment, _logger, path + "/ShadowSystem/", "ignore");
|
||||
var ss = new ShadowFileSystem(fs, sfs);
|
||||
|
||||
Assert.Throws<UnauthorizedAccessException>(() =>
|
||||
@@ -272,17 +254,13 @@ namespace Umbraco.Tests.IO
|
||||
[Test]
|
||||
public void ShadowCreateFile()
|
||||
{
|
||||
var ioHelper = TestHelper.IOHelper;
|
||||
var logger = Mock.Of<ILogger>();
|
||||
var hostingEnvironment = TestHelper.GetHostingEnvironment();
|
||||
|
||||
var path = ioHelper.MapPath("FileSysTests");
|
||||
var path = _ioHelper.MapPath("FileSysTests");
|
||||
Directory.CreateDirectory(path);
|
||||
Directory.CreateDirectory(path + "/ShadowTests");
|
||||
Directory.CreateDirectory(path + "/ShadowSystem");
|
||||
|
||||
var fs = new PhysicalFileSystem(ioHelper, hostingEnvironment, logger, path + "/ShadowTests/", "ignore");
|
||||
var sfs = new PhysicalFileSystem(ioHelper,hostingEnvironment, logger, path + "/ShadowSystem/", "ignore");
|
||||
var fs = new PhysicalFileSystem(_ioHelper, _hostingEnvironment, _logger, path + "/ShadowTests/", "ignore");
|
||||
var sfs = new PhysicalFileSystem(_ioHelper,_hostingEnvironment, _logger, path + "/ShadowSystem/", "ignore");
|
||||
var ss = new ShadowFileSystem(fs, sfs);
|
||||
|
||||
File.WriteAllText(path + "/ShadowTests/f2.txt", "foo");
|
||||
@@ -315,17 +293,13 @@ namespace Umbraco.Tests.IO
|
||||
[Test]
|
||||
public void ShadowCreateFileInDir()
|
||||
{
|
||||
var ioHelper = TestHelper.IOHelper;
|
||||
var logger = Mock.Of<ILogger>();
|
||||
var hostingEnvironment = TestHelper.GetHostingEnvironment();
|
||||
|
||||
var path = ioHelper.MapPath("FileSysTests");
|
||||
var path = _ioHelper.MapPath("FileSysTests");
|
||||
Directory.CreateDirectory(path);
|
||||
Directory.CreateDirectory(path + "/ShadowTests");
|
||||
Directory.CreateDirectory(path + "/ShadowSystem");
|
||||
|
||||
var fs = new PhysicalFileSystem(ioHelper, hostingEnvironment, logger, path + "/ShadowTests/", "ignore");
|
||||
var sfs = new PhysicalFileSystem(ioHelper, hostingEnvironment, logger, path + "/ShadowSystem/", "ignore");
|
||||
var fs = new PhysicalFileSystem(_ioHelper, _hostingEnvironment, _logger, path + "/ShadowTests/", "ignore");
|
||||
var sfs = new PhysicalFileSystem(_ioHelper, _hostingEnvironment, _logger, path + "/ShadowSystem/", "ignore");
|
||||
var ss = new ShadowFileSystem(fs, sfs);
|
||||
|
||||
using (var ms = new MemoryStream(Encoding.UTF8.GetBytes("foo")))
|
||||
@@ -359,17 +333,13 @@ namespace Umbraco.Tests.IO
|
||||
[Test]
|
||||
public void ShadowAbort()
|
||||
{
|
||||
var ioHelper = TestHelper.IOHelper;
|
||||
var logger = Mock.Of<ILogger>();
|
||||
var hostingEnvironment = TestHelper.GetHostingEnvironment();
|
||||
|
||||
var path = ioHelper.MapPath("FileSysTests");
|
||||
var path = _ioHelper.MapPath("FileSysTests");
|
||||
Directory.CreateDirectory(path);
|
||||
Directory.CreateDirectory(path + "/ShadowTests");
|
||||
Directory.CreateDirectory(path + "/ShadowSystem");
|
||||
|
||||
var fs = new PhysicalFileSystem(ioHelper, hostingEnvironment, logger, path + "/ShadowTests/", "ignore");
|
||||
var sfs = new PhysicalFileSystem(ioHelper, hostingEnvironment, logger, path + "/ShadowSystem/", "ignore");
|
||||
var fs = new PhysicalFileSystem(_ioHelper, _hostingEnvironment, _logger, path + "/ShadowTests/", "ignore");
|
||||
var sfs = new PhysicalFileSystem(_ioHelper, _hostingEnvironment, _logger, path + "/ShadowSystem/", "ignore");
|
||||
var ss = new ShadowFileSystem(fs, sfs);
|
||||
|
||||
using (var ms = new MemoryStream(Encoding.UTF8.GetBytes("foo")))
|
||||
@@ -385,17 +355,13 @@ namespace Umbraco.Tests.IO
|
||||
[Test]
|
||||
public void ShadowComplete()
|
||||
{
|
||||
var ioHelper = TestHelper.IOHelper;
|
||||
var logger = Mock.Of<ILogger>();
|
||||
var hostingEnvironment = TestHelper.GetHostingEnvironment();
|
||||
|
||||
var path = ioHelper.MapPath("FileSysTests");
|
||||
var path = _ioHelper.MapPath("FileSysTests");
|
||||
Directory.CreateDirectory(path);
|
||||
Directory.CreateDirectory(path + "/ShadowTests");
|
||||
Directory.CreateDirectory(path + "/ShadowSystem");
|
||||
|
||||
var fs = new PhysicalFileSystem(ioHelper, hostingEnvironment, logger, path + "/ShadowTests/", "ignore");
|
||||
var sfs = new PhysicalFileSystem(ioHelper, hostingEnvironment, logger, path + "/ShadowSystem/", "ignore");
|
||||
var fs = new PhysicalFileSystem(_ioHelper, _hostingEnvironment, _logger, path + "/ShadowTests/", "ignore");
|
||||
var sfs = new PhysicalFileSystem(_ioHelper, _hostingEnvironment, _logger, path + "/ShadowSystem/", "ignore");
|
||||
var ss = new ShadowFileSystem(fs, sfs);
|
||||
|
||||
Directory.CreateDirectory(path + "/ShadowTests/sub/sub");
|
||||
@@ -425,22 +391,18 @@ namespace Umbraco.Tests.IO
|
||||
[Test]
|
||||
public void ShadowScopeComplete()
|
||||
{
|
||||
var logger = Mock.Of<ILogger>();
|
||||
var ioHelper = TestHelper.IOHelper;
|
||||
var hostingEnvironment = TestHelper.GetHostingEnvironment();
|
||||
|
||||
var path = ioHelper.MapPath("FileSysTests");
|
||||
var shadowfs = ioHelper.MapPath(Constants.SystemDirectories.TempData.EnsureEndsWith('/') + "ShadowFs");
|
||||
var path = _ioHelper.MapPath("FileSysTests");
|
||||
var shadowfs = _ioHelper.MapPath(Constants.SystemDirectories.TempData.EnsureEndsWith('/') + "ShadowFs");
|
||||
Directory.CreateDirectory(path);
|
||||
Directory.CreateDirectory(shadowfs);
|
||||
|
||||
var scopedFileSystems = false;
|
||||
|
||||
var phy = new PhysicalFileSystem(ioHelper, hostingEnvironment, logger, path, "ignore");
|
||||
var phy = new PhysicalFileSystem(_ioHelper, _hostingEnvironment, _logger, path, "ignore");
|
||||
|
||||
var container = Mock.Of<IFactory>();
|
||||
var globalSettings = Options.Create(new GlobalSettings());
|
||||
var fileSystems = new FileSystems(container, logger, ioHelper, globalSettings, TestHelper.GetHostingEnvironment()) { IsScoped = () => scopedFileSystems };
|
||||
var fileSystems = new FileSystems(container, _logger, _ioHelper, globalSettings, _hostingEnvironment) { IsScoped = () => scopedFileSystems };
|
||||
var fs = fileSystems.GetFileSystem<FS>(phy);
|
||||
var sw = (ShadowWrapper) fs.InnerFileSystem;
|
||||
|
||||
@@ -451,7 +413,7 @@ namespace Umbraco.Tests.IO
|
||||
string id;
|
||||
|
||||
// explicit shadow without scope does not work
|
||||
sw.Shadow(id = ShadowWrapper.CreateShadowId(ioHelper));
|
||||
sw.Shadow(id = ShadowWrapper.CreateShadowId(_ioHelper));
|
||||
Assert.IsTrue(Directory.Exists(shadowfs + "/" + id));
|
||||
using (var ms = new MemoryStream(Encoding.UTF8.GetBytes("foo")))
|
||||
sw.AddFile("sub/f2.txt", ms);
|
||||
@@ -462,7 +424,7 @@ namespace Umbraco.Tests.IO
|
||||
|
||||
// shadow with scope but no complete does not complete
|
||||
scopedFileSystems = true; // pretend we have a scope
|
||||
var scope = new ShadowFileSystems(fileSystems, id = ShadowWrapper.CreateShadowId(ioHelper));
|
||||
var scope = new ShadowFileSystems(fileSystems, id = ShadowWrapper.CreateShadowId(_ioHelper));
|
||||
Assert.IsTrue(Directory.Exists(shadowfs + "/" + id));
|
||||
using (var ms = new MemoryStream(Encoding.UTF8.GetBytes("foo")))
|
||||
sw.AddFile("sub/f3.txt", ms);
|
||||
@@ -484,7 +446,7 @@ namespace Umbraco.Tests.IO
|
||||
|
||||
// shadow with scope and complete does complete
|
||||
scopedFileSystems = true; // pretend we have a scope
|
||||
scope = new ShadowFileSystems(fileSystems, id = ShadowWrapper.CreateShadowId(ioHelper));
|
||||
scope = new ShadowFileSystems(fileSystems, id = ShadowWrapper.CreateShadowId(_ioHelper));
|
||||
Assert.IsTrue(Directory.Exists(shadowfs + "/" + id));
|
||||
using (var ms = new MemoryStream(Encoding.UTF8.GetBytes("foo")))
|
||||
sw.AddFile("sub/f4.txt", ms);
|
||||
@@ -500,7 +462,7 @@ namespace Umbraco.Tests.IO
|
||||
// test scope for "another thread"
|
||||
|
||||
scopedFileSystems = true; // pretend we have a scope
|
||||
scope = new ShadowFileSystems(fileSystems, id = ShadowWrapper.CreateShadowId(ioHelper));
|
||||
scope = new ShadowFileSystems(fileSystems, id = ShadowWrapper.CreateShadowId(_ioHelper));
|
||||
Assert.IsTrue(Directory.Exists(shadowfs + "/" + id));
|
||||
using (var ms = new MemoryStream(Encoding.UTF8.GetBytes("foo")))
|
||||
sw.AddFile("sub/f5.txt", ms);
|
||||
@@ -523,21 +485,17 @@ namespace Umbraco.Tests.IO
|
||||
[Test]
|
||||
public void ShadowScopeCompleteWithFileConflict()
|
||||
{
|
||||
var logger = Mock.Of<ILogger>();
|
||||
var ioHelper = TestHelper.IOHelper;
|
||||
var hostingEnvironment = TestHelper.GetHostingEnvironment();
|
||||
|
||||
var path = ioHelper.MapPath("FileSysTests");
|
||||
var shadowfs = ioHelper.MapPath(Constants.SystemDirectories.TempData.EnsureEndsWith('/') + "ShadowFs");
|
||||
var path = _ioHelper.MapPath("FileSysTests");
|
||||
var shadowfs = _ioHelper.MapPath(Constants.SystemDirectories.TempData.EnsureEndsWith('/') + "ShadowFs");
|
||||
Directory.CreateDirectory(path);
|
||||
|
||||
var scopedFileSystems = false;
|
||||
|
||||
var phy = new PhysicalFileSystem(ioHelper, hostingEnvironment, logger, path, "ignore");
|
||||
var phy = new PhysicalFileSystem(_ioHelper, _hostingEnvironment, _logger, path, "ignore");
|
||||
|
||||
var container = Mock.Of<IFactory>();
|
||||
var globalSettings = Options.Create(new GlobalSettings());
|
||||
var fileSystems = new FileSystems(container, logger, ioHelper, globalSettings, TestHelper.GetHostingEnvironment()) { IsScoped = () => scopedFileSystems };
|
||||
var fileSystems = new FileSystems(container, _logger, _ioHelper, globalSettings, _hostingEnvironment) { IsScoped = () => scopedFileSystems };
|
||||
var fs = fileSystems.GetFileSystem<FS>( phy);
|
||||
var sw = (ShadowWrapper) fs.InnerFileSystem;
|
||||
|
||||
@@ -548,7 +506,7 @@ namespace Umbraco.Tests.IO
|
||||
string id;
|
||||
|
||||
scopedFileSystems = true; // pretend we have a scope
|
||||
var scope = new ShadowFileSystems(fileSystems, id = ShadowWrapper.CreateShadowId(ioHelper));
|
||||
var scope = new ShadowFileSystems(fileSystems, id = ShadowWrapper.CreateShadowId(_ioHelper));
|
||||
Assert.IsTrue(Directory.Exists(shadowfs + "/" + id));
|
||||
using (var ms = new MemoryStream(Encoding.UTF8.GetBytes("foo")))
|
||||
sw.AddFile("sub/f2.txt", ms);
|
||||
@@ -579,21 +537,17 @@ namespace Umbraco.Tests.IO
|
||||
[Test]
|
||||
public void ShadowScopeCompleteWithDirectoryConflict()
|
||||
{
|
||||
var logger = Mock.Of<ILogger>();
|
||||
var ioHelper = TestHelper.IOHelper;
|
||||
var hostingEnvironment = TestHelper.GetHostingEnvironment();
|
||||
|
||||
var path = ioHelper.MapPath("FileSysTests");
|
||||
var shadowfs = ioHelper.MapPath(Constants.SystemDirectories.TempData.EnsureEndsWith('/') + "ShadowFs");
|
||||
var path = _ioHelper.MapPath("FileSysTests");
|
||||
var shadowfs = _ioHelper.MapPath(Constants.SystemDirectories.TempData.EnsureEndsWith('/') + "ShadowFs");
|
||||
Directory.CreateDirectory(path);
|
||||
|
||||
var scopedFileSystems = false;
|
||||
|
||||
var phy = new PhysicalFileSystem(ioHelper, hostingEnvironment, logger, path, "ignore");
|
||||
var phy = new PhysicalFileSystem(_ioHelper, _hostingEnvironment, _logger, path, "ignore");
|
||||
|
||||
var container = Mock.Of<IFactory>();
|
||||
var globalSettings = Options.Create(new GlobalSettings());
|
||||
var fileSystems = new FileSystems(container, logger, ioHelper, globalSettings, TestHelper.GetHostingEnvironment()) { IsScoped = () => scopedFileSystems };
|
||||
var fileSystems = new FileSystems(container, _logger, _ioHelper, globalSettings, _hostingEnvironment) { IsScoped = () => scopedFileSystems };
|
||||
var fs = fileSystems.GetFileSystem<FS>( phy);
|
||||
var sw = (ShadowWrapper)fs.InnerFileSystem;
|
||||
|
||||
@@ -604,7 +558,7 @@ namespace Umbraco.Tests.IO
|
||||
string id;
|
||||
|
||||
scopedFileSystems = true; // pretend we have a scope
|
||||
var scope = new ShadowFileSystems(fileSystems, id = ShadowWrapper.CreateShadowId(ioHelper));
|
||||
var scope = new ShadowFileSystems(fileSystems, id = ShadowWrapper.CreateShadowId(_ioHelper));
|
||||
Assert.IsTrue(Directory.Exists(shadowfs + "/" + id));
|
||||
using (var ms = new MemoryStream(Encoding.UTF8.GetBytes("foo")))
|
||||
sw.AddFile("sub/f2.txt", ms);
|
||||
@@ -652,9 +606,7 @@ namespace Umbraco.Tests.IO
|
||||
[Test]
|
||||
public void GetFilesReturnsChildrenOnly()
|
||||
{
|
||||
var ioHelper = TestHelper.IOHelper;
|
||||
|
||||
var path = ioHelper.MapPath("FileSysTests");
|
||||
var path = _ioHelper.MapPath("FileSysTests");
|
||||
Directory.CreateDirectory(path);
|
||||
File.WriteAllText(path + "/f1.txt", "foo");
|
||||
Directory.CreateDirectory(path + "/test");
|
||||
@@ -676,9 +628,7 @@ namespace Umbraco.Tests.IO
|
||||
[Test]
|
||||
public void DeleteDirectoryAndFiles()
|
||||
{
|
||||
var ioHelper = TestHelper.IOHelper;
|
||||
|
||||
var path = ioHelper.MapPath("FileSysTests");
|
||||
var path = _ioHelper.MapPath("FileSysTests");
|
||||
Directory.CreateDirectory(path);
|
||||
File.WriteAllText(path + "/f1.txt", "foo");
|
||||
Directory.CreateDirectory(path + "/test");
|
||||
@@ -699,17 +649,13 @@ namespace Umbraco.Tests.IO
|
||||
public void ShadowGetFiles()
|
||||
{
|
||||
// Arrange
|
||||
var ioHelper = TestHelper.IOHelper;
|
||||
var logger = Mock.Of<ILogger>();
|
||||
var hostingEnvironment = TestHelper.GetHostingEnvironment();
|
||||
|
||||
var path = ioHelper.MapPath("FileSysTests");
|
||||
var path = _ioHelper.MapPath("FileSysTests");
|
||||
Directory.CreateDirectory(path);
|
||||
Directory.CreateDirectory(path + "/ShadowTests");
|
||||
Directory.CreateDirectory(path + "/ShadowSystem");
|
||||
|
||||
var fs = new PhysicalFileSystem(ioHelper, hostingEnvironment, logger, path + "/ShadowTests/", "ignore");
|
||||
var sfs = new PhysicalFileSystem(ioHelper, hostingEnvironment, logger, path + "/ShadowSystem/", "ignore");
|
||||
var fs = new PhysicalFileSystem(_ioHelper, _hostingEnvironment, _logger, path + "/ShadowTests/", "ignore");
|
||||
var sfs = new PhysicalFileSystem(_ioHelper, _hostingEnvironment, _logger, path + "/ShadowSystem/", "ignore");
|
||||
var ss = new ShadowFileSystem(fs, sfs);
|
||||
|
||||
// Act
|
||||
@@ -735,17 +681,13 @@ namespace Umbraco.Tests.IO
|
||||
public void ShadowGetFilesUsingEmptyFilter()
|
||||
{
|
||||
// Arrange
|
||||
var ioHelper = TestHelper.IOHelper;
|
||||
var logger = Mock.Of<ILogger>();
|
||||
var hostingEnvironment = TestHelper.GetHostingEnvironment();
|
||||
|
||||
var path = ioHelper.MapPath("FileSysTests");
|
||||
var path = _ioHelper.MapPath("FileSysTests");
|
||||
Directory.CreateDirectory(path);
|
||||
Directory.CreateDirectory(path + "/ShadowTests");
|
||||
Directory.CreateDirectory(path + "/ShadowSystem");
|
||||
|
||||
var fs = new PhysicalFileSystem(ioHelper, hostingEnvironment, logger, path + "/ShadowTests/", "ignore");
|
||||
var sfs = new PhysicalFileSystem(ioHelper, hostingEnvironment, logger, path + "/ShadowSystem/", "ignore");
|
||||
var fs = new PhysicalFileSystem(_ioHelper, _hostingEnvironment, _logger, path + "/ShadowTests/", "ignore");
|
||||
var sfs = new PhysicalFileSystem(_ioHelper, _hostingEnvironment, _logger, path + "/ShadowSystem/", "ignore");
|
||||
var ss = new ShadowFileSystem(fs, sfs);
|
||||
|
||||
// Act
|
||||
@@ -774,17 +716,13 @@ namespace Umbraco.Tests.IO
|
||||
public void ShadowGetFilesUsingNullFilter()
|
||||
{
|
||||
// Arrange
|
||||
var ioHelper = TestHelper.IOHelper;
|
||||
var logger = Mock.Of<ILogger>();
|
||||
var hostingEnvironment = TestHelper.GetHostingEnvironment();
|
||||
|
||||
var path = ioHelper.MapPath("FileSysTests");
|
||||
var path = _ioHelper.MapPath("FileSysTests");
|
||||
Directory.CreateDirectory(path);
|
||||
Directory.CreateDirectory(path + "/ShadowTests");
|
||||
Directory.CreateDirectory(path + "/ShadowSystem");
|
||||
|
||||
var fs = new PhysicalFileSystem(ioHelper, hostingEnvironment, logger, path + "/ShadowTests/", "ignore");
|
||||
var sfs = new PhysicalFileSystem(ioHelper, hostingEnvironment, logger, path + "/ShadowSystem/", "ignore");
|
||||
var fs = new PhysicalFileSystem(_ioHelper, _hostingEnvironment, _logger, path + "/ShadowTests/", "ignore");
|
||||
var sfs = new PhysicalFileSystem(_ioHelper, _hostingEnvironment, _logger, path + "/ShadowSystem/", "ignore");
|
||||
var ss = new ShadowFileSystem(fs, sfs);
|
||||
|
||||
// Act
|
||||
@@ -810,17 +748,13 @@ namespace Umbraco.Tests.IO
|
||||
public void ShadowGetFilesUsingWildcardFilter()
|
||||
{
|
||||
// Arrange
|
||||
var ioHelper = TestHelper.IOHelper;
|
||||
var logger = Mock.Of<ILogger>();
|
||||
var hostingEnvironment = TestHelper.GetHostingEnvironment();
|
||||
|
||||
var path = ioHelper.MapPath("FileSysTests");
|
||||
var path = _ioHelper.MapPath("FileSysTests");
|
||||
Directory.CreateDirectory(path);
|
||||
Directory.CreateDirectory(path + "/ShadowTests");
|
||||
Directory.CreateDirectory(path + "/ShadowSystem");
|
||||
|
||||
var fs = new PhysicalFileSystem(ioHelper, hostingEnvironment, logger, path + "/ShadowTests/", "ignore");
|
||||
var sfs = new PhysicalFileSystem(ioHelper, hostingEnvironment, logger, path + "/ShadowSystem/", "ignore");
|
||||
var fs = new PhysicalFileSystem(_ioHelper, _hostingEnvironment, _logger, path + "/ShadowTests/", "ignore");
|
||||
var sfs = new PhysicalFileSystem(_ioHelper, _hostingEnvironment, _logger, path + "/ShadowSystem/", "ignore");
|
||||
var ss = new ShadowFileSystem(fs, sfs);
|
||||
|
||||
// Act
|
||||
@@ -849,17 +783,13 @@ namespace Umbraco.Tests.IO
|
||||
public void ShadowGetFilesUsingSingleCharacterFilter()
|
||||
{
|
||||
// Arrange
|
||||
var ioHelper = TestHelper.IOHelper;
|
||||
var logger = Mock.Of<ILogger>();
|
||||
var hostingEnvironment = TestHelper.GetHostingEnvironment();
|
||||
|
||||
var path = ioHelper.MapPath("FileSysTests");
|
||||
var path = _ioHelper.MapPath("FileSysTests");
|
||||
Directory.CreateDirectory(path);
|
||||
Directory.CreateDirectory(path + "/ShadowTests");
|
||||
Directory.CreateDirectory(path + "/ShadowSystem");
|
||||
|
||||
var fs = new PhysicalFileSystem(ioHelper, hostingEnvironment, logger, path + "/ShadowTests/", "ignore");
|
||||
var sfs = new PhysicalFileSystem(ioHelper, hostingEnvironment, logger, path + "/ShadowSystem/", "ignore");
|
||||
var fs = new PhysicalFileSystem(_ioHelper, _hostingEnvironment, _logger, path + "/ShadowTests/", "ignore");
|
||||
var sfs = new PhysicalFileSystem(_ioHelper, _hostingEnvironment, _logger, path + "/ShadowSystem/", "ignore");
|
||||
var ss = new ShadowFileSystem(fs, sfs);
|
||||
|
||||
// Act
|
||||
@@ -900,17 +830,13 @@ namespace Umbraco.Tests.IO
|
||||
public void ShadowGetFullPath()
|
||||
{
|
||||
// Arrange
|
||||
var ioHelper = TestHelper.IOHelper;
|
||||
var logger = Mock.Of<ILogger>();
|
||||
var hostingEnvironment = TestHelper.GetHostingEnvironment();
|
||||
|
||||
var path = ioHelper.MapPath("FileSysTests");
|
||||
var path = _ioHelper.MapPath("FileSysTests");
|
||||
Directory.CreateDirectory(path);
|
||||
Directory.CreateDirectory(path + "/ShadowTests");
|
||||
Directory.CreateDirectory(path + "/ShadowSystem");
|
||||
|
||||
var fs = new PhysicalFileSystem(ioHelper, hostingEnvironment, logger, path + "/ShadowTests/", "ignore");
|
||||
var sfs = new PhysicalFileSystem(ioHelper, hostingEnvironment, logger, path + "/ShadowSystem/", "ignore");
|
||||
var fs = new PhysicalFileSystem(_ioHelper, _hostingEnvironment, _logger, path + "/ShadowTests/", "ignore");
|
||||
var sfs = new PhysicalFileSystem(_ioHelper, _hostingEnvironment, _logger, path + "/ShadowSystem/", "ignore");
|
||||
var ss = new ShadowFileSystem(fs, sfs);
|
||||
|
||||
// Act
|
||||
@@ -938,17 +864,13 @@ namespace Umbraco.Tests.IO
|
||||
public void ShadowGetRelativePath()
|
||||
{
|
||||
// Arrange
|
||||
var ioHelper = TestHelper.IOHelper;
|
||||
var logger = Mock.Of<ILogger>();
|
||||
var hostingEnvironment = TestHelper.GetHostingEnvironment();
|
||||
|
||||
var path = ioHelper.MapPath("FileSysTests");
|
||||
var path = _ioHelper.MapPath("FileSysTests");
|
||||
Directory.CreateDirectory(path);
|
||||
Directory.CreateDirectory(path + "/ShadowTests");
|
||||
Directory.CreateDirectory(path + "/ShadowSystem");
|
||||
|
||||
var fs = new PhysicalFileSystem(ioHelper, hostingEnvironment, logger, path + "/ShadowTests/", "ignore");
|
||||
var sfs = new PhysicalFileSystem(ioHelper, hostingEnvironment, logger, path + "/ShadowSystem/", "ignore");
|
||||
var fs = new PhysicalFileSystem(_ioHelper, _hostingEnvironment, _logger, path + "/ShadowTests/", "ignore");
|
||||
var sfs = new PhysicalFileSystem(_ioHelper, _hostingEnvironment, _logger, path + "/ShadowSystem/", "ignore");
|
||||
var ss = new ShadowFileSystem(fs, sfs);
|
||||
|
||||
// Act
|
||||
@@ -981,17 +903,13 @@ namespace Umbraco.Tests.IO
|
||||
public void ShadowGetUrl()
|
||||
{
|
||||
// Arrange
|
||||
var ioHelper = TestHelper.IOHelper;
|
||||
var logger = Mock.Of<ILogger>();
|
||||
var hostingEnvironment = TestHelper.GetHostingEnvironment();
|
||||
|
||||
var path = ioHelper.MapPath("FileSysTests");
|
||||
var path = _ioHelper.MapPath("FileSysTests");
|
||||
Directory.CreateDirectory(path);
|
||||
Directory.CreateDirectory(path + "/ShadowTests");
|
||||
Directory.CreateDirectory(path + "/ShadowSystem");
|
||||
|
||||
var fs = new PhysicalFileSystem(ioHelper, hostingEnvironment, logger, path + "/ShadowTests/", "rootUrl");
|
||||
var sfs = new PhysicalFileSystem(ioHelper, hostingEnvironment, logger, path + "/ShadowSystem/", "rootUrl");
|
||||
var fs = new PhysicalFileSystem(_ioHelper, _hostingEnvironment, _logger, path + "/ShadowTests/", "rootUrl");
|
||||
var sfs = new PhysicalFileSystem(_ioHelper, _hostingEnvironment, _logger, path + "/ShadowSystem/", "rootUrl");
|
||||
var ss = new ShadowFileSystem(fs, sfs);
|
||||
|
||||
// Act
|
||||
|
||||
@@ -118,10 +118,13 @@
|
||||
<Compile Include="Cache\DistributedCacheBinderTests.cs" />
|
||||
<Compile Include="Cache\RefresherTests.cs" />
|
||||
<Compile Include="Cache\SnapDictionaryTests.cs" />
|
||||
<Compile Include="IO\AbstractFileSystemTests.cs" />
|
||||
<Compile Include="IO\FileSystemsTests.cs" />
|
||||
<Compile Include="IO\PhysicalFileSystemTests.cs" />
|
||||
<Compile Include="IO\ShadowFileSystemTests.cs" />
|
||||
<Compile Include="LegacyXmlPublishedCache\ContentXmlDto.cs" />
|
||||
<Compile Include="LegacyXmlPublishedCache\PreviewXmlDto.cs" />
|
||||
<Compile Include="Logging\LogviewerTests.cs" />
|
||||
<Compile Include="Manifest\ManifestContentAppTests.cs" />
|
||||
<Compile Include="Migrations\MigrationPlanTests.cs" />
|
||||
<Compile Include="Migrations\MigrationTests.cs" />
|
||||
<Compile Include="Models\ContentXmlTest.cs" />
|
||||
@@ -164,7 +167,6 @@
|
||||
<Compile Include="TestHelpers\RandomIdRamDirectory.cs" />
|
||||
<Compile Include="TestHelpers\Stubs\TestUserPasswordConfig.cs" />
|
||||
<Compile Include="Testing\Objects\TestDataSource.cs" />
|
||||
<Compile Include="IO\ShadowFileSystemTests.cs" />
|
||||
<Compile Include="Issues\U9560.cs" />
|
||||
<Compile Include="Integration\ContentEventsTests.cs" />
|
||||
<Compile Include="Migrations\AdvancedMigrationTests.cs" />
|
||||
@@ -277,7 +279,6 @@
|
||||
<Compile Include="Services\RelationServiceTests.cs" />
|
||||
<Compile Include="Services\MacroServiceTests.cs" />
|
||||
<Compile Include="Services\UserServiceTests.cs" />
|
||||
<Compile Include="Manifest\ManifestParserTests.cs" />
|
||||
<Compile Include="Cache\PublishedCache\PublishedMediaCacheTests.cs" />
|
||||
<Compile Include="Migrations\AlterMigrationTests.cs" />
|
||||
<Compile Include="Migrations\SqlScripts\SqlResources.Designer.cs">
|
||||
@@ -303,7 +304,6 @@
|
||||
<Compile Include="PublishedContent\PublishedContentTests.cs" />
|
||||
<Compile Include="PublishedContent\PublishedMediaTests.cs" />
|
||||
<Compile Include="Web\Mvc\HtmlHelperExtensionMethodsTests.cs" />
|
||||
<Compile Include="IO\IoHelperTests.cs" />
|
||||
<Compile Include="Models\ContentTests.cs" />
|
||||
<Compile Include="Persistence\SqlCeTableByTableTest.cs" />
|
||||
<Compile Include="Persistence\DatabaseContextTests.cs" />
|
||||
@@ -372,9 +372,6 @@
|
||||
<Compile Include="UmbracoExamine\ExamineDemoDataContentService.cs" />
|
||||
<Compile Include="TestHelpers\Stubs\TestLastChanceFinder.cs" />
|
||||
<Compile Include="TestHelpers\TestHelper.cs" />
|
||||
<Compile Include="IO\AbstractFileSystemTests.cs" />
|
||||
<Compile Include="IO\FileSystemsTests.cs" />
|
||||
<Compile Include="IO\PhysicalFileSystemTests.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="TestHelpers\FakeHttpContextFactory.cs" />
|
||||
<Compile Include="Routing\UmbracoModuleTests.cs" />
|
||||
|
||||
@@ -100,7 +100,7 @@ namespace Umbraco.Web.Common.AspNetCore
|
||||
if (Uri.IsWellFormedUriString(virtualPath, UriKind.Absolute))
|
||||
return virtualPath;
|
||||
|
||||
var fullPath = ApplicationVirtualPath.EnsureEndsWith('/') + virtualPath.TrimStart("~/");
|
||||
var fullPath = ApplicationVirtualPath.EnsureEndsWith('/') + virtualPath.TrimStart("~/").TrimStart("/");
|
||||
|
||||
return fullPath;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user