@@ -16,4 +16,8 @@
|
||||
<ProjectReference Include="..\Umbraco.Core\Umbraco.Core.csproj" />
|
||||
<ProjectReference Include="..\Umbraco.Infrastructure\Umbraco.Infrastructure.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="TestHelpers\Objects" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
|
||||
@@ -1,13 +1,18 @@
|
||||
using Moq;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.Extensions.Options;
|
||||
using Moq;
|
||||
using Umbraco.Core.Configuration.Models;
|
||||
using Umbraco.Core.Hosting;
|
||||
using Umbraco.Core.Security;
|
||||
using Umbraco.Core.Services;
|
||||
using Umbraco.Tests.Common;
|
||||
using Umbraco.Tests.TestHelpers;
|
||||
using Umbraco.Web;
|
||||
using Umbraco.Web.Common.AspNetCore;
|
||||
using Umbraco.Web.PublishedCache;
|
||||
using Umbraco.Web.Routing;
|
||||
using Umbraco.Web.Security;
|
||||
|
||||
namespace Umbraco.Tests.Testing.Objects
|
||||
namespace Umbraco.Tests.UnitTests.TestHelpers.Objects
|
||||
{
|
||||
/// <summary>
|
||||
/// Simplify creating test UmbracoContext's
|
||||
@@ -21,8 +26,8 @@ namespace Umbraco.Tests.Testing.Objects
|
||||
{
|
||||
if (globalSettings == null) globalSettings = new GlobalSettings();
|
||||
if (umbracoContextAccessor == null) umbracoContextAccessor = new TestUmbracoContextAccessor();
|
||||
if (httpContextAccessor == null) httpContextAccessor = TestHelper.GetHttpContextAccessor();
|
||||
if (publishedUrlProvider == null) publishedUrlProvider = TestHelper.GetPublishedUrlProvider();
|
||||
if (httpContextAccessor == null) httpContextAccessor = Mock.Of<IHttpContextAccessor>();
|
||||
if (publishedUrlProvider == null) publishedUrlProvider = Mock.Of<IPublishedUrlProvider>();
|
||||
|
||||
var contentCache = new Mock<IPublishedContentCache>();
|
||||
var mediaCache = new Mock<IPublishedMediaCache>();
|
||||
@@ -32,19 +37,25 @@ namespace Umbraco.Tests.Testing.Objects
|
||||
var snapshotService = new Mock<IPublishedSnapshotService>();
|
||||
snapshotService.Setup(x => x.CreatePublishedSnapshot(It.IsAny<string>())).Returns(snapshot.Object);
|
||||
|
||||
|
||||
|
||||
var hostingEnvironment = Mock.Of<IHostingEnvironment>();
|
||||
var backofficeSecurityAccessorMock = new Mock<IBackofficeSecurityAccessor>();
|
||||
backofficeSecurityAccessorMock.Setup(x => x.BackofficeSecurity).Returns(Mock.Of<IBackofficeSecurity>());
|
||||
|
||||
|
||||
var umbracoContextFactory = new UmbracoContextFactory(
|
||||
umbracoContextAccessor,
|
||||
snapshotService.Object,
|
||||
new TestVariationContextAccessor(),
|
||||
new TestDefaultCultureAccessor(),
|
||||
globalSettings,
|
||||
Options.Create<GlobalSettings>(globalSettings),
|
||||
Mock.Of<IUserService>(),
|
||||
TestHelper.GetHostingEnvironment(),
|
||||
TestHelper.UriUtility,
|
||||
hostingEnvironment,
|
||||
new UriUtility(hostingEnvironment),
|
||||
httpContextAccessor,
|
||||
new AspNetCookieManager(httpContextAccessor));
|
||||
new AspNetCoreCookieManager(httpContextAccessor),
|
||||
Mock.Of<IRequestAccessor>(),
|
||||
backofficeSecurityAccessorMock.Object
|
||||
);
|
||||
|
||||
return umbracoContextFactory;
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using Microsoft.Extensions.Options;
|
||||
using Moq;
|
||||
using NUnit.Framework;
|
||||
using Umbraco.Core;
|
||||
@@ -8,7 +9,7 @@ using Umbraco.Core.Configuration.Models;
|
||||
using Umbraco.Core.Models;
|
||||
using Umbraco.Core.Models.PublishedContent;
|
||||
using Umbraco.Tests.Common;
|
||||
using Umbraco.Tests.Testing.Objects;
|
||||
using Umbraco.Tests.UnitTests.TestHelpers.Objects;
|
||||
using Umbraco.Web.Routing;
|
||||
using Umbraco.Web.Templates;
|
||||
|
||||
@@ -75,7 +76,7 @@ namespace Umbraco.Tests.Templates
|
||||
|
||||
var webRoutingSettings = new WebRoutingSettings();
|
||||
var publishedUrlProvider = new UrlProvider(umbracoContextAccessor,
|
||||
Microsoft.Extensions.Options.Options.Create(webRoutingSettings),
|
||||
Options.Create(webRoutingSettings),
|
||||
new UrlProviderCollection(Enumerable.Empty<IUrlProvider>()),
|
||||
new MediaUrlProviderCollection(new []{mediaUrlProvider.Object}),
|
||||
Mock.Of<IVariationContextAccessor>()
|
||||
@@ -7,7 +7,7 @@ using Umbraco.Core.Configuration.Models;
|
||||
using Umbraco.Core.Models;
|
||||
using Umbraco.Core.Models.PublishedContent;
|
||||
using Umbraco.Tests.Common;
|
||||
using Umbraco.Tests.Testing.Objects;
|
||||
using Umbraco.Tests.UnitTests.TestHelpers.Objects;
|
||||
using Umbraco.Web.Routing;
|
||||
using Umbraco.Web.Templates;
|
||||
|
||||
@@ -164,7 +164,6 @@
|
||||
<Compile Include="Services\MemberGroupServiceTests.cs" />
|
||||
<Compile Include="Services\MediaTypeServiceTests.cs" />
|
||||
<Compile Include="Services\PropertyValidationServiceTests.cs" />
|
||||
<Compile Include="Templates\HtmlLocalLinkParserTests.cs" />
|
||||
<Compile Include="TestHelpers\RandomIdRamDirectory.cs" />
|
||||
<Compile Include="TestHelpers\Stubs\TestUserPasswordConfig.cs" />
|
||||
<Compile Include="Testing\Objects\TestDataSource.cs" />
|
||||
@@ -182,7 +181,6 @@
|
||||
<Compile Include="Routing\UrlRoutesTests.cs" />
|
||||
<Compile Include="Routing\UrlsProviderWithDomainsTests.cs" />
|
||||
<Compile Include="Scheduling\BackgroundTaskRunnerTests2.cs" />
|
||||
<Compile Include="Scoping\EventNameExtractorTests.cs" />
|
||||
<Compile Include="Scoping\PassThroughEventDispatcherTests.cs" />
|
||||
<Compile Include="Scoping\ScopedRepositoryTests.cs" />
|
||||
<Compile Include="Scoping\ScopedXmlTests.cs" />
|
||||
@@ -203,7 +201,6 @@
|
||||
<Compile Include="TestHelpers\ControllerTesting\TraceExceptionLogger.cs" />
|
||||
<Compile Include="Testing\Objects\Accessors\NoHttpContextAccessor.cs" />
|
||||
<Compile Include="TestHelpers\Stubs\TestExamineManager.cs" />
|
||||
<Compile Include="Testing\Objects\TestUmbracoContextFactory.cs" />
|
||||
<Compile Include="Testing\TestDatabase.cs" />
|
||||
<Compile Include="Testing\TestingTests\NUnitTests.cs" />
|
||||
<Compile Include="Persistence\LocksTests.cs" />
|
||||
@@ -215,7 +212,6 @@
|
||||
<Compile Include="TestHelpers\TestObjects-Mocks.cs" />
|
||||
<Compile Include="TestHelpers\TestObjects.cs" />
|
||||
<Compile Include="UmbracoExamine\RandomIdRamDirectory.cs" />
|
||||
<Compile Include="UmbracoExamine\UmbracoContentValueSetValidatorTests.cs" />
|
||||
<Compile Include="Web\AngularIntegration\AngularAntiForgeryTests.cs" />
|
||||
<Compile Include="Web\AngularIntegration\ContentModelSerializationTests.cs" />
|
||||
<Compile Include="Web\AngularIntegration\JsInitializationTests.cs" />
|
||||
@@ -230,7 +226,6 @@
|
||||
<Compile Include="Web\Controllers\UserEditorAuthorizationHelperTests.cs" />
|
||||
<Compile Include="Web\HealthChecks\HealthCheckResultsTests.cs" />
|
||||
<Compile Include="Web\HttpCookieExtensionsTests.cs" />
|
||||
<Compile Include="Templates\HtmlImageSourceParserTests.cs" />
|
||||
<Compile Include="Web\Mvc\HtmlStringUtilitiesTests.cs" />
|
||||
<Compile Include="Web\Mvc\RenderIndexActionSelectorAttributeTests.cs" />
|
||||
<Compile Include="Persistence\NPocoTests\PetaPocoCachesTest.cs" />
|
||||
@@ -291,7 +286,6 @@
|
||||
<Compile Include="Services\MacroServiceTests.cs" />
|
||||
<Compile Include="Services\UserServiceTests.cs" />
|
||||
<Compile Include="Manifest\ManifestParserTests.cs" />
|
||||
<Compile Include="Templates\ViewHelperTests.cs" />
|
||||
<Compile Include="Cache\PublishedCache\PublishedMediaCacheTests.cs" />
|
||||
<Compile Include="Migrations\AlterMigrationTests.cs" />
|
||||
<Compile Include="Migrations\SqlScripts\SqlResources.Designer.cs">
|
||||
@@ -506,7 +500,6 @@
|
||||
<Content Include="Services\Importing\XsltSearch-Package.xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="Models\Mapping\" />
|
||||
<Folder Include="Web\Validation\" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
|
||||
Reference in New Issue
Block a user