Merge pull request #7425 from umbraco/netcore/feature/AB3677-remove-current-from-core
Netcore: Removed Current (Core)
This commit is contained in:
@@ -8,8 +8,6 @@ namespace Umbraco.Core
|
||||
{
|
||||
public static class PublishedContentExtensions
|
||||
{
|
||||
private static IVariationContextAccessor VariationContextAccessor => Current.VariationContextAccessor;
|
||||
|
||||
/// <summary>
|
||||
/// Determines whether the content has a culture.
|
||||
/// </summary>
|
||||
@@ -28,13 +26,14 @@ namespace Umbraco.Core
|
||||
/// Filters a sequence of <see cref="IPublishedContent"/> to return invariant items, and items that are published for the specified culture.
|
||||
/// </summary>
|
||||
/// <param name="contents">The content items.</param>
|
||||
/// <param name="variationContextAccessor"></param>
|
||||
/// <param name="culture">The specific culture to filter for. If null is used the current culture is used. (Default is null).</param>
|
||||
internal static IEnumerable<T> WhereIsInvariantOrHasCulture<T>(this IEnumerable<T> contents, string culture = null)
|
||||
internal static IEnumerable<T> WhereIsInvariantOrHasCulture<T>(this IEnumerable<T> contents, IVariationContextAccessor variationContextAccessor, string culture = null)
|
||||
where T : class, IPublishedContent
|
||||
{
|
||||
if (contents == null) throw new ArgumentNullException(nameof(contents));
|
||||
|
||||
culture = culture ?? Current.VariationContextAccessor.VariationContext?.Culture ?? "";
|
||||
culture = culture ?? variationContextAccessor.VariationContext?.Culture ?? "";
|
||||
|
||||
// either does not vary by culture, or has the specified culture
|
||||
return contents.Where(x => !x.ContentType.VariesByCulture() || HasCulture(x, culture));
|
||||
@@ -44,8 +43,9 @@ namespace Umbraco.Core
|
||||
/// Gets the name of the content item.
|
||||
/// </summary>
|
||||
/// <param name="content">The content item.</param>
|
||||
/// <param name="variationContextAccessor"></param>
|
||||
/// <param name="culture">The specific culture to get the name for. If null is used the current culture is used (Default is null).</param>
|
||||
public static string Name(this IPublishedContent content, string culture = null)
|
||||
public static string Name(this IPublishedContent content, IVariationContextAccessor variationContextAccessor, string culture = null)
|
||||
{
|
||||
// invariant has invariant value (whatever the requested culture)
|
||||
if (!content.ContentType.VariesByCulture())
|
||||
@@ -53,7 +53,7 @@ namespace Umbraco.Core
|
||||
|
||||
// handle context culture for variant
|
||||
if (culture == null)
|
||||
culture = VariationContextAccessor?.VariationContext?.Culture ?? "";
|
||||
culture = variationContextAccessor?.VariationContext?.Culture ?? "";
|
||||
|
||||
// get
|
||||
return culture != "" && content.Cultures.TryGetValue(culture, out var infos) ? infos.Name : null;
|
||||
@@ -64,8 +64,9 @@ namespace Umbraco.Core
|
||||
/// Gets the url segment of the content item.
|
||||
/// </summary>
|
||||
/// <param name="content">The content item.</param>
|
||||
/// <param name="variationContextAccessor"></param>
|
||||
/// <param name="culture">The specific culture to get the url segment for. If null is used the current culture is used (Default is null).</param>
|
||||
public static string UrlSegment(this IPublishedContent content, string culture = null)
|
||||
public static string UrlSegment(this IPublishedContent content, IVariationContextAccessor variationContextAccessor, string culture = null)
|
||||
{
|
||||
// invariant has invariant value (whatever the requested culture)
|
||||
if (!content.ContentType.VariesByCulture())
|
||||
@@ -73,7 +74,7 @@ namespace Umbraco.Core
|
||||
|
||||
// handle context culture for variant
|
||||
if (culture == null)
|
||||
culture = VariationContextAccessor?.VariationContext?.Culture ?? "";
|
||||
culture = variationContextAccessor?.VariationContext?.Culture ?? "";
|
||||
|
||||
// get
|
||||
return culture != "" && content.Cultures.TryGetValue(culture, out var infos) ? infos.UrlSegment : null;
|
||||
@@ -83,8 +84,9 @@ namespace Umbraco.Core
|
||||
/// Gets the culture date of the content item.
|
||||
/// </summary>
|
||||
/// <param name="content">The content item.</param>
|
||||
/// <param name="variationContextAccessor"></param>
|
||||
/// <param name="culture">The specific culture to get the name for. If null is used the current culture is used (Default is null).</param>
|
||||
public static DateTime CultureDate(this IPublishedContent content, string culture = null)
|
||||
public static DateTime CultureDate(this IPublishedContent content, IVariationContextAccessor variationContextAccessor, string culture = null)
|
||||
{
|
||||
// invariant has invariant value (whatever the requested culture)
|
||||
if (!content.ContentType.VariesByCulture())
|
||||
@@ -92,7 +94,7 @@ namespace Umbraco.Core
|
||||
|
||||
// handle context culture for variant
|
||||
if (culture == null)
|
||||
culture = VariationContextAccessor?.VariationContext?.Culture ?? "";
|
||||
culture = variationContextAccessor?.VariationContext?.Culture ?? "";
|
||||
|
||||
// get
|
||||
return culture != "" && content.Cultures.TryGetValue(culture, out var infos) ? infos.Date : DateTime.MinValue;
|
||||
@@ -103,14 +105,15 @@ namespace Umbraco.Core
|
||||
/// Gets the children of the content item.
|
||||
/// </summary>
|
||||
/// <param name="content">The content item.</param>
|
||||
/// <param name="variationContextAccessor"></param>
|
||||
/// <param name="culture">
|
||||
/// The specific culture to get the url children for. Default is null which will use the current culture in <see cref="VariationContext"/>
|
||||
/// The specific culture to get the url children for. Default is null which will use the current culture in <see cref="VariationContext"/>
|
||||
/// </param>
|
||||
/// <remarks>
|
||||
/// <para>Gets children that are available for the specified culture.</para>
|
||||
/// <para>Children are sorted by their sortOrder.</para>
|
||||
/// <para>
|
||||
/// For culture,
|
||||
/// For culture,
|
||||
/// if null is used the current culture is used.
|
||||
/// If an empty string is used only invariant children are returned.
|
||||
/// If "*" is used all children are returned.
|
||||
@@ -121,11 +124,11 @@ namespace Umbraco.Core
|
||||
/// However, if an empty string is specified only invariant children are returned.
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
public static IEnumerable<IPublishedContent> Children(this IPublishedContent content, string culture = null)
|
||||
public static IEnumerable<IPublishedContent> Children(this IPublishedContent content, IVariationContextAccessor variationContextAccessor, string culture = null)
|
||||
{
|
||||
// handle context culture for variant
|
||||
if (culture == null)
|
||||
culture = VariationContextAccessor?.VariationContext?.Culture ?? "";
|
||||
culture = variationContextAccessor?.VariationContext?.Culture ?? "";
|
||||
|
||||
var children = content.ChildrenForAllCultures;
|
||||
return culture == "*"
|
||||
@@ -5,6 +5,7 @@ using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using Umbraco.Core.Composing;
|
||||
using Umbraco.Core.Strings;
|
||||
|
||||
namespace Umbraco.Core
|
||||
{
|
||||
@@ -427,5 +428,54 @@ namespace Umbraco.Core
|
||||
return type.GetCustomAttributes(typeof (T), inherited).OfType<T>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Tries to return a value based on a property name for an object but ignores case sensitivity
|
||||
/// </summary>
|
||||
/// <param name="type"></param>
|
||||
/// <param name="shortStringHelper"></param>
|
||||
/// <param name="target"></param>
|
||||
/// <param name="memberName"></param>
|
||||
/// <returns></returns>
|
||||
/// <remarks>
|
||||
/// Currently this will only work for ProperCase and camelCase properties, see the TODO below to enable complete case insensitivity
|
||||
/// </remarks>
|
||||
internal static Attempt<object> GetMemberIgnoreCase(this Type type, IShortStringHelper shortStringHelper, object target, string memberName)
|
||||
{
|
||||
Func<string, Attempt<object>> getMember =
|
||||
memberAlias =>
|
||||
{
|
||||
try
|
||||
{
|
||||
return Attempt<object>.Succeed(
|
||||
type.InvokeMember(memberAlias,
|
||||
System.Reflection.BindingFlags.GetProperty |
|
||||
System.Reflection.BindingFlags.Instance |
|
||||
System.Reflection.BindingFlags.Public,
|
||||
null,
|
||||
target,
|
||||
null));
|
||||
}
|
||||
catch (MissingMethodException ex)
|
||||
{
|
||||
return Attempt<object>.Fail(ex);
|
||||
}
|
||||
};
|
||||
|
||||
//try with the current casing
|
||||
var attempt = getMember(memberName);
|
||||
if (attempt.Success == false)
|
||||
{
|
||||
//if we cannot get with the current alias, try changing it's case
|
||||
attempt = memberName[0].IsUpperCase()
|
||||
? getMember(memberName.ToCleanString(shortStringHelper, CleanStringType.Ascii | CleanStringType.ConvertCase | CleanStringType.CamelCase))
|
||||
: getMember(memberName.ToCleanString(shortStringHelper, CleanStringType.Ascii | CleanStringType.ConvertCase | CleanStringType.PascalCase));
|
||||
|
||||
// TODO: If this still fails then we should get a list of properties from the object and then compare - doing the above without listing
|
||||
// all properties will surely be faster than using reflection to get ALL properties first and then query against them.
|
||||
}
|
||||
|
||||
return attempt;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,5 +24,9 @@
|
||||
<_Parameter1>Umbraco.Tests.Benchmarks</_Parameter1>
|
||||
</AssemblyAttribute>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="Logging\Viewer" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using Umbraco.Composing;
|
||||
using Umbraco.Core.Composing;
|
||||
using Umbraco.Core.Configuration;
|
||||
using Umbraco.Core.IO;
|
||||
|
||||
@@ -241,7 +240,7 @@ namespace Umbraco.Core
|
||||
/// <remarks>Default uri.AbsolutePath does not support relative uris.</remarks>
|
||||
public static string GetSafeAbsolutePathDecoded(this Uri uri)
|
||||
{
|
||||
return System.Web.HttpUtility.UrlDecode(uri.GetSafeAbsolutePath());
|
||||
return System.Net.WebUtility.UrlDecode(uri.GetSafeAbsolutePath());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -1,223 +0,0 @@
|
||||
using System;
|
||||
using Umbraco.Core.Cache;
|
||||
using Umbraco.Core.Configuration;
|
||||
using Umbraco.Core.Dictionary;
|
||||
using Umbraco.Core.Hosting;
|
||||
using Umbraco.Core.IO;
|
||||
using Umbraco.Core.Logging;
|
||||
using Umbraco.Core.Mapping;
|
||||
using Umbraco.Core.Models.PublishedContent;
|
||||
using Umbraco.Core.PackageActions;
|
||||
using Umbraco.Core.Packaging;
|
||||
using Umbraco.Core.Persistence;
|
||||
using Umbraco.Core.PropertyEditors;
|
||||
using Umbraco.Core.Scoping;
|
||||
using Umbraco.Core.Security;
|
||||
using Umbraco.Core.Services;
|
||||
using Umbraco.Core.Strings;
|
||||
using Umbraco.Core.Sync;
|
||||
using Umbraco.Net;
|
||||
|
||||
namespace Umbraco.Core.Composing
|
||||
{
|
||||
/// <summary>
|
||||
/// Provides a static service locator for most singletons.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// <para>This class is initialized with the container in UmbracoApplicationBase,
|
||||
/// right after the container is created in UmbracoApplicationBase.HandleApplicationStart.</para>
|
||||
/// <para>Obviously, this is a service locator, which some may consider an anti-pattern. And yet,
|
||||
/// practically, it works.</para>
|
||||
/// </remarks>
|
||||
public static class Current
|
||||
{
|
||||
private static IFactory _factory;
|
||||
|
||||
// TODO: get rid of these oddities
|
||||
// we don't want Umbraco tests to die because the container has not been properly initialized,
|
||||
// for some too-important things such as IShortStringHelper or loggers, so if it's not
|
||||
// registered we setup a default one. We should really refactor our tests so that it does
|
||||
// not happen.
|
||||
|
||||
private static IShortStringHelper _shortStringHelper;
|
||||
private static ILogger _logger;
|
||||
private static IProfiler _profiler;
|
||||
private static IProfilingLogger _profilingLogger;
|
||||
private static IPublishedValueFallback _publishedValueFallback;
|
||||
private static Configs _configs;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the factory.
|
||||
/// </summary>
|
||||
public static IFactory Factory
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_factory == null) throw new InvalidOperationException("No factory has been set.");
|
||||
return _factory;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (_factory != null) throw new InvalidOperationException("A factory has already been set.");
|
||||
if (_configs != null) throw new InvalidOperationException("Configs are unlocked.");
|
||||
_factory = value;
|
||||
}
|
||||
}
|
||||
|
||||
public static bool HasFactory => _factory != null;
|
||||
|
||||
/// <summary>
|
||||
/// Resets <see cref="Current"/>. Indented for testing only, and not supported in production code.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// <para>For UNIT TESTS exclusively.</para>
|
||||
/// <para>Resets everything that is 'current'.</para>
|
||||
/// </remarks>
|
||||
public static void Reset()
|
||||
{
|
||||
_factory.DisposeIfDisposable();
|
||||
_factory = null;
|
||||
|
||||
_configs = null;
|
||||
_shortStringHelper = null;
|
||||
_logger = null;
|
||||
_profiler = null;
|
||||
_profilingLogger = null;
|
||||
_publishedValueFallback = null;
|
||||
|
||||
Resetted?.Invoke(null, EventArgs.Empty);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Unlocks <see cref="Configs"/>. Intended for testing only, and not supported in production code.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// <para>For UNIT TESTS exclusively.</para>
|
||||
/// <para>Unlocks <see cref="Configs"/> so that it is possible to add configurations
|
||||
/// directly to <see cref="Current"/> without having to wire composition.</para>
|
||||
/// </remarks>
|
||||
public static void UnlockConfigs(IConfigsFactory configsFactory, IIOHelper ioHelper)
|
||||
{
|
||||
if (_factory != null)
|
||||
throw new InvalidOperationException("Cannot unlock configs when a factory has been set.");
|
||||
_configs = configsFactory.Create(ioHelper);
|
||||
}
|
||||
|
||||
internal static event EventHandler Resetted;
|
||||
|
||||
#region Getters
|
||||
|
||||
public static UmbracoMapper Mapper
|
||||
=> _factory.GetInstance<UmbracoMapper>();
|
||||
|
||||
public static IShortStringHelper ShortStringHelper
|
||||
=> _shortStringHelper ?? (_shortStringHelper = _factory?.TryGetInstance<IShortStringHelper>()
|
||||
?? new DefaultShortStringHelper(new DefaultShortStringHelperConfig().WithDefault(Configs.Settings())));
|
||||
|
||||
public static ILogger Logger
|
||||
=> _logger ?? (_logger = _factory?.TryGetInstance<ILogger>()
|
||||
?? new DebugDiagnosticsLogger(new MessageTemplates()));
|
||||
|
||||
public static IProfiler Profiler
|
||||
=> _profiler ?? (_profiler = _factory?.TryGetInstance<IProfiler>()
|
||||
?? new LogProfiler(Logger));
|
||||
|
||||
public static IProfilingLogger ProfilingLogger
|
||||
=> _profilingLogger ?? (_profilingLogger = _factory?.TryGetInstance<IProfilingLogger>())
|
||||
?? new ProfilingLogger(Logger, Profiler);
|
||||
|
||||
public static IRuntimeState RuntimeState
|
||||
=> Factory.GetInstance<IRuntimeState>();
|
||||
|
||||
public static TypeLoader TypeLoader
|
||||
=> Factory.GetInstance<TypeLoader>();
|
||||
|
||||
public static Configs Configs
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_configs != null) return _configs;
|
||||
if (_factory == null) throw new InvalidOperationException("Can not get Current.Config during composition. Use composition.Config.");
|
||||
return _factory.GetInstance<Configs>();
|
||||
}
|
||||
}
|
||||
|
||||
public static IFileSystems FileSystems
|
||||
=> Factory.GetInstance<IFileSystems>();
|
||||
|
||||
public static IMediaFileSystem MediaFileSystem
|
||||
=> Factory.GetInstance<IMediaFileSystem>();
|
||||
|
||||
public static UrlSegmentProviderCollection UrlSegmentProviders
|
||||
=> Factory.GetInstance<UrlSegmentProviderCollection>();
|
||||
|
||||
public static CacheRefresherCollection CacheRefreshers
|
||||
=> Factory.GetInstance<CacheRefresherCollection>();
|
||||
|
||||
public static DataEditorCollection DataEditors
|
||||
=> Factory.GetInstance<DataEditorCollection>();
|
||||
|
||||
public static DataValueReferenceFactoryCollection DataValueReferenceFactories
|
||||
=> Factory.GetInstance<DataValueReferenceFactoryCollection>();
|
||||
|
||||
public static PropertyEditorCollection PropertyEditors
|
||||
=> Factory.GetInstance<PropertyEditorCollection>();
|
||||
|
||||
public static ParameterEditorCollection ParameterEditors
|
||||
=> Factory.GetInstance<ParameterEditorCollection>();
|
||||
|
||||
internal static ManifestValueValidatorCollection ManifestValidators
|
||||
=> Factory.GetInstance<ManifestValueValidatorCollection>();
|
||||
|
||||
internal static PackageActionCollection PackageActions
|
||||
=> Factory.GetInstance<PackageActionCollection>();
|
||||
|
||||
internal static IPackageActionRunner PackageActionRunner
|
||||
=> Factory.GetInstance<IPackageActionRunner>();
|
||||
|
||||
internal static PropertyValueConverterCollection PropertyValueConverters
|
||||
=> Factory.GetInstance<PropertyValueConverterCollection>();
|
||||
|
||||
internal static IPublishedModelFactory PublishedModelFactory
|
||||
=> Factory.GetInstance<IPublishedModelFactory>();
|
||||
|
||||
public static IServerMessenger ServerMessenger
|
||||
=> Factory.GetInstance<IServerMessenger>();
|
||||
|
||||
public static IServerRegistrar ServerRegistrar
|
||||
=> Factory.GetInstance<IServerRegistrar>();
|
||||
|
||||
public static ICultureDictionaryFactory CultureDictionaryFactory
|
||||
=> Factory.GetInstance<ICultureDictionaryFactory>();
|
||||
|
||||
public static AppCaches AppCaches
|
||||
=> Factory.GetInstance<AppCaches>();
|
||||
|
||||
public static ServiceContext Services
|
||||
=> Factory.GetInstance<ServiceContext>();
|
||||
|
||||
public static IScopeProvider ScopeProvider
|
||||
=> Factory.GetInstance<IScopeProvider>();
|
||||
|
||||
public static ISqlContext SqlContext
|
||||
=> Factory.GetInstance<ISqlContext>();
|
||||
|
||||
public static IPublishedContentTypeFactory PublishedContentTypeFactory
|
||||
=> Factory.GetInstance<IPublishedContentTypeFactory>();
|
||||
|
||||
public static IPublishedValueFallback PublishedValueFallback
|
||||
=> _publishedValueFallback ?? Factory.GetInstance<IPublishedValueFallback>() ?? new NoopPublishedValueFallback();
|
||||
|
||||
public static IVariationContextAccessor VariationContextAccessor
|
||||
=> Factory.GetInstance<IVariationContextAccessor>();
|
||||
|
||||
public static IIOHelper IOHelper => Factory.GetInstance<IIOHelper>();
|
||||
|
||||
|
||||
public static IHostingEnvironment HostingEnvironment => Factory.GetInstance<IHostingEnvironment>();
|
||||
public static IBackOfficeInfo BackOfficeInfo => Factory.GetInstance<IBackOfficeInfo>();
|
||||
public static ISessionIdResolver SessionIdResolver => Factory.GetInstance<ISessionIdResolver>();
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -5,6 +5,7 @@ using System.Collections.Specialized;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using Umbraco.Core.Composing;
|
||||
using Umbraco.Core.Configuration;
|
||||
using Umbraco.Core.Models.Entities;
|
||||
using Umbraco.Core.Models.Membership;
|
||||
|
||||
@@ -37,12 +38,12 @@ namespace Umbraco.Core.Models.Identity
|
||||
/// <param name="email">This is allowed to be null (but would need to be filled in if trying to persist this instance)</param>
|
||||
/// <param name="culture"></param>
|
||||
/// <returns></returns>
|
||||
public static BackOfficeIdentityUser CreateNew(string username, string email, string culture)
|
||||
public static BackOfficeIdentityUser CreateNew(IGlobalSettings globalSettings, string username, string email, string culture)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(username)) throw new ArgumentException("Value cannot be null or whitespace.", nameof(username));
|
||||
if (string.IsNullOrWhiteSpace(culture)) throw new ArgumentException("Value cannot be null or whitespace.", nameof(culture));
|
||||
|
||||
var user = new BackOfficeIdentityUser(Array.Empty<IReadOnlyUserGroup>());
|
||||
var user = new BackOfficeIdentityUser(globalSettings, Array.Empty<IReadOnlyUserGroup>());
|
||||
user.DisableChangeTracking();
|
||||
user._userName = username;
|
||||
user._email = email;
|
||||
@@ -55,12 +56,12 @@ namespace Umbraco.Core.Models.Identity
|
||||
return user;
|
||||
}
|
||||
|
||||
private BackOfficeIdentityUser(IReadOnlyUserGroup[] groups)
|
||||
private BackOfficeIdentityUser(IGlobalSettings globalSettings, IReadOnlyUserGroup[] groups)
|
||||
{
|
||||
_startMediaIds = Array.Empty<int>();
|
||||
_startContentIds = Array.Empty<int>();
|
||||
_allowedSections = Array.Empty<string>();
|
||||
_culture = Current.Configs.Global().DefaultUILanguage; // TODO: inject
|
||||
_culture = globalSettings.DefaultUILanguage;
|
||||
|
||||
// must initialize before setting groups
|
||||
_roles = new ObservableCollection<IdentityUserRole<string>>();
|
||||
@@ -73,10 +74,11 @@ namespace Umbraco.Core.Models.Identity
|
||||
/// <summary>
|
||||
/// Creates an existing user with the specified groups
|
||||
/// </summary>
|
||||
/// <param name="globalSettings"></param>
|
||||
/// <param name="userId"></param>
|
||||
/// <param name="groups"></param>
|
||||
public BackOfficeIdentityUser(int userId, IEnumerable<IReadOnlyUserGroup> groups)
|
||||
: this(groups.ToArray())
|
||||
public BackOfficeIdentityUser(IGlobalSettings globalSettings, int userId, IEnumerable<IReadOnlyUserGroup> groups)
|
||||
: this(globalSettings, groups.ToArray())
|
||||
{
|
||||
// use the property setters - they do more than just setting a field
|
||||
Id = userId;
|
||||
@@ -426,6 +428,6 @@ namespace Umbraco.Core.Models.Identity
|
||||
private static readonly DelegateEqualityComparer<int[]> StartIdsComparer = new DelegateEqualityComparer<int[]>(
|
||||
(groups, enumerable) => groups.UnsortedSequenceEqual(enumerable),
|
||||
groups => groups.GetHashCode());
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ namespace Umbraco.Core.Models.Identity
|
||||
mapper.Define<IUser, BackOfficeIdentityUser>(
|
||||
(source, context) =>
|
||||
{
|
||||
var target = new BackOfficeIdentityUser(source.Id, source.Groups);
|
||||
var target = new BackOfficeIdentityUser(_globalSettings, source.Id, source.Groups);
|
||||
target.DisableChangeTracking();
|
||||
return target;
|
||||
},
|
||||
|
||||
@@ -202,7 +202,7 @@ namespace Umbraco.Core.Runtime
|
||||
composers.Compose();
|
||||
|
||||
// create the factory
|
||||
_factory = Current.Factory = composition.CreateFactory();
|
||||
_factory = composition.CreateFactory();
|
||||
|
||||
// create & initialize the components
|
||||
_components = _factory.GetInstance<ComponentCollection>();
|
||||
@@ -229,7 +229,7 @@ namespace Umbraco.Core.Runtime
|
||||
{
|
||||
try
|
||||
{
|
||||
_factory = Current.Factory = composition?.CreateFactory();
|
||||
_factory = composition?.CreateFactory();
|
||||
}
|
||||
catch { /* yea */ }
|
||||
}
|
||||
|
||||
@@ -129,14 +129,12 @@
|
||||
<Compile Include="Compose\AuditEventsComponent.cs" />
|
||||
<Compile Include="Compose\AuditEventsComposer.cs" />
|
||||
<Compile Include="Composing\CompositionExtensions\CoreMappingProfiles.cs" />
|
||||
<Compile Include="Composing\Current.cs" />
|
||||
<Compile Include="Models\Identity\BackOfficeIdentityUser.cs" />
|
||||
<Compile Include="Models\Identity\IdentityMapDefinition.cs" />
|
||||
<Compile Include="Models\Identity\IdentityUser.cs" />
|
||||
<Compile Include="Models\Identity\UserLoginInfoWrapper.cs" />
|
||||
<Compile Include="Persistence\SqlCeBulkSqlInsertProvider.cs" />
|
||||
<Compile Include="Persistence\SqlSyntax\SqlCeSyntaxProvider.cs" />
|
||||
<Compile Include="PublishedContentExtensions.cs" />
|
||||
<Compile Include="Runtime\CoreInitialComposer.cs" />
|
||||
<Compile Include="Runtime\CoreRuntime.cs" />
|
||||
<Compile Include="Security\AuthenticationExtensions.cs" />
|
||||
@@ -153,7 +151,6 @@
|
||||
<Compile Include="Security\IUserSessionStore.cs" />
|
||||
<Compile Include="Security\UmbracoEmailMessage.cs" />
|
||||
<Compile Include="Security\UserAwarePasswordHasher.cs" />
|
||||
<Compile Include="ServiceContextExtensions.cs" />
|
||||
<Compile Include="..\SolutionInfo.cs">
|
||||
<Link>Properties\SolutionInfo.cs</Link>
|
||||
</Compile>
|
||||
|
||||
@@ -22,9 +22,6 @@ namespace Umbraco.Core.PropertyEditors
|
||||
[DataContract]
|
||||
public class DataEditor : IDataEditor
|
||||
{
|
||||
private readonly IDataTypeService _dataTypeService;
|
||||
private readonly ILocalizationService _localizationService;
|
||||
private readonly ILocalizedTextService _localizedTextService;
|
||||
private IDictionary<string, object> _defaultConfiguration;
|
||||
private IDataValueEditor _dataValueEditor;
|
||||
|
||||
@@ -33,11 +30,12 @@ namespace Umbraco.Core.PropertyEditors
|
||||
/// </summary>
|
||||
public DataEditor(ILogger logger, IDataTypeService dataTypeService, ILocalizationService localizationService, ILocalizedTextService localizedTextService, IShortStringHelper shortStringHelper, EditorType type = EditorType.PropertyValue)
|
||||
{
|
||||
_dataTypeService = dataTypeService;
|
||||
_localizationService = localizationService;
|
||||
_localizedTextService = localizedTextService;
|
||||
ShortStringHelper = shortStringHelper ?? throw new ArgumentNullException(nameof(shortStringHelper));
|
||||
Logger = logger ?? throw new ArgumentNullException(nameof(logger));
|
||||
DataTypeService = dataTypeService ?? throw new ArgumentNullException(nameof(dataTypeService));
|
||||
LocalizationService = localizationService ?? throw new ArgumentNullException(nameof(localizationService));
|
||||
LocalizedTextService = localizedTextService ?? throw new ArgumentNullException(nameof(localizedTextService));
|
||||
ShortStringHelper = shortStringHelper ?? throw new ArgumentNullException(nameof(shortStringHelper));
|
||||
|
||||
|
||||
// defaults
|
||||
Type = type;
|
||||
@@ -62,6 +60,9 @@ namespace Umbraco.Core.PropertyEditors
|
||||
protected DataEditorAttribute Attribute { get; }
|
||||
|
||||
protected IShortStringHelper ShortStringHelper { get; }
|
||||
protected ILocalizedTextService LocalizedTextService { get; }
|
||||
protected ILocalizationService LocalizationService { get; }
|
||||
protected IDataTypeService DataTypeService { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets a logger.
|
||||
@@ -179,7 +180,7 @@ namespace Umbraco.Core.PropertyEditors
|
||||
if (Attribute == null)
|
||||
throw new InvalidOperationException($"The editor is not attributed with {nameof(DataEditorAttribute)}");
|
||||
|
||||
return new DataValueEditor(_dataTypeService, _localizationService, _localizedTextService, ShortStringHelper, Attribute);
|
||||
return new DataValueEditor(DataTypeService, LocalizationService, LocalizedTextService, ShortStringHelper, Attribute);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -18,10 +18,7 @@ namespace Umbraco.Core.PropertyEditors
|
||||
public class LabelPropertyEditor : DataEditor
|
||||
{
|
||||
private readonly IIOHelper _ioHelper;
|
||||
private readonly IDataTypeService _dataTypeService;
|
||||
private readonly ILocalizedTextService _localizedTextService;
|
||||
private readonly ILocalizationService _localizationService;
|
||||
private readonly IShortStringHelper _shortStringHelper;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="LabelPropertyEditor"/> class.
|
||||
@@ -30,14 +27,10 @@ namespace Umbraco.Core.PropertyEditors
|
||||
: base(logger, dataTypeService, localizationService, localizedTextService, shortStringHelper)
|
||||
{
|
||||
_ioHelper = ioHelper;
|
||||
_dataTypeService = dataTypeService;
|
||||
_localizedTextService = localizedTextService;
|
||||
_localizationService = localizationService;
|
||||
_shortStringHelper = shortStringHelper;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override IDataValueEditor CreateValueEditor() => new LabelPropertyValueEditor(_dataTypeService, _localizationService,_localizedTextService, _shortStringHelper, Attribute);
|
||||
protected override IDataValueEditor CreateValueEditor() => new LabelPropertyValueEditor(DataTypeService, LocalizationService,LocalizedTextService, ShortStringHelper, Attribute);
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override IConfigurationEditor CreateConfigurationEditor() => new LabelConfigurationEditor(_ioHelper);
|
||||
|
||||
@@ -78,7 +78,7 @@ namespace Umbraco.ModelsBuilder.Embedded.Configuration
|
||||
value = ConfigurationManager.AppSettings[prefix + "ModelsDirectory"];
|
||||
if (!string.IsNullOrWhiteSpace(value))
|
||||
{
|
||||
var root = Current.IOHelper.MapPath("~/");
|
||||
var root = _ioHelper.MapPath("~/");
|
||||
if (root == null)
|
||||
throw new ConfigurationErrorsException("Could not determine root directory.");
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
using System;
|
||||
using System.Web;
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Core.Composing;
|
||||
using Umbraco.Web.Composing;
|
||||
using Umbraco.ModelsBuilder.Embedded;
|
||||
|
||||
// will install only if configuration says it needs to be installed
|
||||
|
||||
@@ -1,15 +1,10 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Moq;
|
||||
using NUnit.Framework;
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Core.Cache;
|
||||
using Umbraco.Core.Composing;
|
||||
using Umbraco.Core.Logging;
|
||||
using Umbraco.Web.Composing;
|
||||
using Umbraco.Core.Sync;
|
||||
using Umbraco.Tests.Components;
|
||||
using Umbraco.Tests.TestHelpers;
|
||||
|
||||
namespace Umbraco.Tests.Cache.DistributedCache
|
||||
{
|
||||
@@ -21,22 +16,21 @@ namespace Umbraco.Tests.Cache.DistributedCache
|
||||
{
|
||||
private Umbraco.Web.Cache.DistributedCache _distributedCache;
|
||||
|
||||
private IServerRegistrar ServerRegistrar { get; set; }
|
||||
private TestServerMessenger ServerMessenger { get; set; }
|
||||
|
||||
[SetUp]
|
||||
public void Setup()
|
||||
{
|
||||
var register = TestHelper.GetRegister();
|
||||
ServerRegistrar = new TestServerRegistrar();
|
||||
ServerMessenger = new TestServerMessenger();
|
||||
|
||||
var composition = new Composition(register, TestHelper.GetMockedTypeLoader(), Mock.Of<IProfilingLogger>(), ComponentTests.MockRuntimeState(RuntimeLevel.Run), TestHelper.GetConfigs(), TestHelper.IOHelper, AppCaches.NoCache);
|
||||
var cacheRefresherCollection = new CacheRefresherCollection(new []
|
||||
{
|
||||
new TestCacheRefresher()
|
||||
});
|
||||
|
||||
composition.RegisterUnique<IServerRegistrar>(_ => new TestServerRegistrar());
|
||||
composition.RegisterUnique<IServerMessenger>(_ => new TestServerMessenger());
|
||||
|
||||
composition.WithCollectionBuilder<CacheRefresherCollectionBuilder>()
|
||||
.Add<TestCacheRefresher>();
|
||||
|
||||
Current.Factory = composition.CreateFactory();
|
||||
|
||||
_distributedCache = new Umbraco.Web.Cache.DistributedCache();
|
||||
_distributedCache = new Umbraco.Web.Cache.DistributedCache(ServerMessenger, cacheRefresherCollection);
|
||||
}
|
||||
|
||||
[TearDown]
|
||||
@@ -52,7 +46,7 @@ namespace Umbraco.Tests.Cache.DistributedCache
|
||||
{
|
||||
_distributedCache.Refresh(Guid.Parse("E0F452CB-DCB2-4E84-B5A5-4F01744C5C73"), i);
|
||||
}
|
||||
Assert.AreEqual(10, ((TestServerMessenger)Current.ServerMessenger).IntIdsRefreshed.Count);
|
||||
Assert.AreEqual(10, ServerMessenger.IntIdsRefreshed.Count);
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -65,7 +59,7 @@ namespace Umbraco.Tests.Cache.DistributedCache
|
||||
x => x.Id,
|
||||
new TestObjectWithId{Id = i});
|
||||
}
|
||||
Assert.AreEqual(10, ((TestServerMessenger)Current.ServerMessenger).IntIdsRefreshed.Count);
|
||||
Assert.AreEqual(10, ServerMessenger.IntIdsRefreshed.Count);
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -75,7 +69,7 @@ namespace Umbraco.Tests.Cache.DistributedCache
|
||||
{
|
||||
_distributedCache.Refresh(Guid.Parse("E0F452CB-DCB2-4E84-B5A5-4F01744C5C73"), Guid.NewGuid());
|
||||
}
|
||||
Assert.AreEqual(11, ((TestServerMessenger)Current.ServerMessenger).GuidIdsRefreshed.Count);
|
||||
Assert.AreEqual(11, ServerMessenger.GuidIdsRefreshed.Count);
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -85,7 +79,7 @@ namespace Umbraco.Tests.Cache.DistributedCache
|
||||
{
|
||||
_distributedCache.Remove(Guid.Parse("E0F452CB-DCB2-4E84-B5A5-4F01744C5C73"), i);
|
||||
}
|
||||
Assert.AreEqual(12, ((TestServerMessenger)Current.ServerMessenger).IntIdsRemoved.Count);
|
||||
Assert.AreEqual(12, ServerMessenger.IntIdsRemoved.Count);
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -95,7 +89,7 @@ namespace Umbraco.Tests.Cache.DistributedCache
|
||||
{
|
||||
_distributedCache.RefreshAll(Guid.Parse("E0F452CB-DCB2-4E84-B5A5-4F01744C5C73"));
|
||||
}
|
||||
Assert.AreEqual(13, ((TestServerMessenger)Current.ServerMessenger).CountOfFullRefreshes);
|
||||
Assert.AreEqual(13, ServerMessenger.CountOfFullRefreshes);
|
||||
}
|
||||
|
||||
#region internal test classes
|
||||
|
||||
@@ -4,7 +4,6 @@ using System.Threading;
|
||||
using Moq;
|
||||
using NUnit.Framework;
|
||||
using Umbraco.Core.Composing;
|
||||
using Umbraco.Core.Configuration.UmbracoSettings;
|
||||
using Umbraco.Core.Events;
|
||||
using Umbraco.Core.Models;
|
||||
using Umbraco.Core.Models.Membership;
|
||||
@@ -15,6 +14,7 @@ using Umbraco.Web;
|
||||
using Umbraco.Web.Cache;
|
||||
using Umbraco.Web.PublishedCache;
|
||||
using Umbraco.Web.Routing;
|
||||
using Current = Umbraco.Web.Composing.Current;
|
||||
|
||||
namespace Umbraco.Tests.Cache
|
||||
{
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Moq;
|
||||
using NUnit.Framework;
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Core.Cache;
|
||||
using Umbraco.Core.Composing;
|
||||
using Umbraco.Core.Logging;
|
||||
|
||||
@@ -4,7 +4,7 @@ using Moq;
|
||||
using NUnit.Framework;
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Core.Cache;
|
||||
using Umbraco.Core.Composing;
|
||||
using Umbraco.Web.Composing;
|
||||
using Umbraco.Core.Configuration;
|
||||
using Umbraco.Core.Configuration.UmbracoSettings;
|
||||
using Umbraco.Core.Services;
|
||||
@@ -68,9 +68,9 @@ namespace Umbraco.Tests.Cache.PublishedCache
|
||||
var appCache = new DictionaryAppCache();
|
||||
var domainCache = new DomainCache(ServiceContext.DomainService, DefaultCultureAccessor);
|
||||
var publishedShapshot = new PublishedSnapshot(
|
||||
new PublishedContentCache(xmlStore, domainCache, appCache, globalSettings, ContentTypesCache, null, null),
|
||||
new PublishedMediaCache(xmlStore, ServiceContext.MediaService, ServiceContext.UserService, appCache, ContentTypesCache, Factory.GetInstance<IEntityXmlSerializer>(), umbracoContextAccessor),
|
||||
new PublishedMemberCache(null, appCache, Current.Services.MemberService, ContentTypesCache, Current.Services.UserService),
|
||||
new PublishedContentCache(xmlStore, domainCache, appCache, globalSettings, ContentTypesCache, null, VariationContextAccessor, null),
|
||||
new PublishedMediaCache(xmlStore, ServiceContext.MediaService, ServiceContext.UserService, appCache, ContentTypesCache, Factory.GetInstance<IEntityXmlSerializer>(), umbracoContextAccessor, VariationContextAccessor),
|
||||
new PublishedMemberCache(null, appCache, Current.Services.MemberService, ContentTypesCache, Current.Services.UserService, VariationContextAccessor),
|
||||
domainCache);
|
||||
var publishedSnapshotService = new Mock<IPublishedSnapshotService>();
|
||||
publishedSnapshotService.Setup(x => x.CreatePublishedSnapshot(It.IsAny<string>())).Returns(publishedShapshot);
|
||||
|
||||
@@ -6,7 +6,6 @@ using Examine;
|
||||
using NUnit.Framework;
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Core.Cache;
|
||||
using Umbraco.Core.Composing;
|
||||
using Umbraco.Core.Models.PublishedContent;
|
||||
using Umbraco.Core.Strings;
|
||||
using Umbraco.Tests.TestHelpers;
|
||||
@@ -79,7 +78,7 @@ namespace Umbraco.Tests.Cache.PublishedCache
|
||||
var mChild2 = MakeNewMedia("Child2", mType, user, mRoot2.Id);
|
||||
|
||||
var ctx = GetUmbracoContext("/test");
|
||||
var cache = new PublishedMediaCache(new XmlStore((XmlDocument) null, null, null, null, HostingEnvironment), ServiceContext.MediaService, ServiceContext.UserService, new DictionaryAppCache(), ContentTypesCache, Factory.GetInstance<IEntityXmlSerializer>(), Factory.GetInstance<IUmbracoContextAccessor>());
|
||||
var cache = new PublishedMediaCache(new XmlStore((XmlDocument) null, null, null, null, HostingEnvironment), ServiceContext.MediaService, ServiceContext.UserService, new DictionaryAppCache(), ContentTypesCache, Factory.GetInstance<IEntityXmlSerializer>(), Factory.GetInstance<IUmbracoContextAccessor>(), VariationContextAccessor);
|
||||
var roots = cache.GetAtRoot();
|
||||
Assert.AreEqual(2, roots.Count());
|
||||
Assert.IsTrue(roots.Select(x => x.Id).ContainsAll(new[] {mRoot1.Id, mRoot2.Id}));
|
||||
@@ -97,7 +96,7 @@ namespace Umbraco.Tests.Cache.PublishedCache
|
||||
|
||||
//var publishedMedia = PublishedMediaTests.GetNode(mRoot.Id, GetUmbracoContext("/test", 1234));
|
||||
var umbracoContext = GetUmbracoContext("/test");
|
||||
var cache = new PublishedMediaCache(new XmlStore((XmlDocument)null, null, null, null, HostingEnvironment), Current.Services.MediaService, Current.Services.UserService, new DictionaryAppCache(), ContentTypesCache, Factory.GetInstance<IEntityXmlSerializer>(), Factory.GetInstance<IUmbracoContextAccessor>());
|
||||
var cache = new PublishedMediaCache(new XmlStore((XmlDocument)null, null, null, null, HostingEnvironment), Current.Services.MediaService, Current.Services.UserService, new DictionaryAppCache(), ContentTypesCache, Factory.GetInstance<IEntityXmlSerializer>(), Factory.GetInstance<IUmbracoContextAccessor>(), VariationContextAccessor);
|
||||
var publishedMedia = cache.GetById(mRoot.Id);
|
||||
Assert.IsNotNull(publishedMedia);
|
||||
|
||||
@@ -208,7 +207,7 @@ namespace Umbraco.Tests.Cache.PublishedCache
|
||||
|
||||
var result = new SearchResult("1234", 1, () => fields.ToDictionary(x => x.Key, x => new List<string> { x.Value }));
|
||||
|
||||
var store = new PublishedMediaCache(new XmlStore((XmlDocument)null, null, null, null, HostingEnvironment), ServiceContext.MediaService, ServiceContext.UserService, new DictionaryAppCache(), ContentTypesCache, Factory.GetInstance<IEntityXmlSerializer>(), Factory.GetInstance<IUmbracoContextAccessor>());
|
||||
var store = new PublishedMediaCache(new XmlStore((XmlDocument)null, null, null, null, HostingEnvironment), ServiceContext.MediaService, ServiceContext.UserService, new DictionaryAppCache(), ContentTypesCache, Factory.GetInstance<IEntityXmlSerializer>(), Factory.GetInstance<IUmbracoContextAccessor>(), VariationContextAccessor);
|
||||
var doc = store.CreateFromCacheValues(store.ConvertFromSearchResult(result));
|
||||
|
||||
DoAssert(doc, 1234, key, null, 0, "/media/test.jpg", "Image", 23, "Shannon", "Shannon", 0, 0, "-1,1234", DateTime.Parse("2012-07-17T10:34:09"), DateTime.Parse("2012-07-16T10:34:09"), 2);
|
||||
@@ -224,7 +223,7 @@ namespace Umbraco.Tests.Cache.PublishedCache
|
||||
var xmlDoc = GetMediaXml();
|
||||
((XmlElement)xmlDoc.DocumentElement.FirstChild).SetAttribute("key", key.ToString());
|
||||
var navigator = xmlDoc.SelectSingleNode("/root/Image").CreateNavigator();
|
||||
var cache = new PublishedMediaCache(new XmlStore((XmlDocument)null, null, null, null, HostingEnvironment), ServiceContext.MediaService, ServiceContext.UserService, new DictionaryAppCache(), ContentTypesCache, Factory.GetInstance<IEntityXmlSerializer>(), Factory.GetInstance<IUmbracoContextAccessor>());
|
||||
var cache = new PublishedMediaCache(new XmlStore((XmlDocument)null, null, null, null, HostingEnvironment), ServiceContext.MediaService, ServiceContext.UserService, new DictionaryAppCache(), ContentTypesCache, Factory.GetInstance<IEntityXmlSerializer>(), Factory.GetInstance<IUmbracoContextAccessor>(),VariationContextAccessor);
|
||||
var doc = cache.CreateFromCacheValues(cache.ConvertFromXPathNavigator(navigator, true));
|
||||
|
||||
DoAssert(doc, 2000, key, null, 2, "image1", "Image", 23, "Shannon", "Shannon", 33, 33, "-1,2000", DateTime.Parse("2012-06-12T14:13:17"), DateTime.Parse("2012-07-20T18:50:43"), 1);
|
||||
@@ -319,6 +318,7 @@ namespace Umbraco.Tests.Cache.PublishedCache
|
||||
// callback to get a property
|
||||
(dd, a) => dd.Properties.FirstOrDefault(x => x.Alias.InvariantEquals(a)),
|
||||
null, // cache provider
|
||||
VariationContextAccessor,
|
||||
ContentTypesCache,
|
||||
// no xpath
|
||||
null,
|
||||
@@ -329,6 +329,7 @@ namespace Umbraco.Tests.Cache.PublishedCache
|
||||
// callback to get a property
|
||||
(dd, a) => dd.Properties.FirstOrDefault(x => x.Alias.InvariantEquals(a)),
|
||||
null, // cache provider
|
||||
VariationContextAccessor,
|
||||
ContentTypesCache,
|
||||
// no xpath
|
||||
null,
|
||||
|
||||
@@ -3,13 +3,13 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Moq;
|
||||
using NUnit.Framework;
|
||||
using Umbraco.Core.Composing;
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Core.Cache;
|
||||
using Umbraco.Core.Configuration;
|
||||
using Umbraco.Core.Composing;
|
||||
using Umbraco.Core.Logging;
|
||||
using Umbraco.Tests.Components;
|
||||
using Umbraco.Tests.TestHelpers;
|
||||
using Current = Umbraco.Web.Composing.Current;
|
||||
|
||||
namespace Umbraco.Tests.Composing
|
||||
{
|
||||
|
||||
@@ -5,10 +5,9 @@ using Moq;
|
||||
using NUnit.Framework;
|
||||
using Umbraco.Core.Cache;
|
||||
using Umbraco.Core.Composing;
|
||||
using Umbraco.Core.Configuration;
|
||||
using Umbraco.Core.IO;
|
||||
using Umbraco.Core.Logging;
|
||||
using Umbraco.Tests.TestHelpers;
|
||||
using Current = Umbraco.Web.Composing.Current;
|
||||
|
||||
namespace Umbraco.Tests.Composing
|
||||
{
|
||||
|
||||
@@ -6,10 +6,10 @@ using NUnit.Framework;
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Core.Cache;
|
||||
using Umbraco.Core.Composing;
|
||||
using Umbraco.Core.Configuration;
|
||||
using Umbraco.Core.Logging;
|
||||
using Umbraco.Tests.Components;
|
||||
using Umbraco.Tests.TestHelpers;
|
||||
using Current = Umbraco.Web.Composing.Current;
|
||||
|
||||
namespace Umbraco.Tests.Composing
|
||||
{
|
||||
|
||||
@@ -24,17 +24,19 @@ namespace Umbraco.Tests.Composing
|
||||
|
||||
var composition = new Composition(container, TestHelper.GetMockedTypeLoader(), Mock.Of<IProfilingLogger>(), ComponentTests.MockRuntimeState(RuntimeLevel.Run), TestHelper.GetConfigs(), TestHelper.IOHelper, AppCaches.NoCache);
|
||||
|
||||
var expectedPackageActions = TypeLoader.GetPackageActions();
|
||||
composition.WithCollectionBuilder<PackageActionCollectionBuilder>()
|
||||
.Add(() => TypeLoader.GetPackageActions());
|
||||
.Add(() => expectedPackageActions);
|
||||
|
||||
Current.Factory = composition.CreateFactory();
|
||||
var factory = composition.CreateFactory();
|
||||
|
||||
var actions = Current.PackageActions;
|
||||
var actions = factory.GetInstance<PackageActionCollection>();
|
||||
Assert.AreEqual(2, actions.Count());
|
||||
|
||||
// order is unspecified, but both must be there
|
||||
var hasAction1 = actions.ElementAt(0) is PackageAction1 || actions.ElementAt(1) is PackageAction1;
|
||||
var hasAction2 = actions.ElementAt(0) is PackageAction2 || actions.ElementAt(1) is PackageAction2;
|
||||
|
||||
Assert.IsTrue(hasAction1);
|
||||
Assert.IsTrue(hasAction2);
|
||||
}
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
using Moq;
|
||||
using NUnit.Framework;
|
||||
using NUnit.Framework.Internal;
|
||||
using Umbraco.Core.Composing;
|
||||
using Umbraco.Core.Configuration;
|
||||
using Umbraco.Tests.TestHelpers;
|
||||
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
using System;
|
||||
using NUnit.Framework;
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Core.Composing;
|
||||
using Umbraco.Core.Configuration.UmbracoSettings;
|
||||
using Umbraco.Core.Strings;
|
||||
using Umbraco.Tests.Testing;
|
||||
|
||||
@@ -1,20 +1,12 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using Moq;
|
||||
using Newtonsoft.Json;
|
||||
using NUnit.Framework;
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Core.Cache;
|
||||
using Umbraco.Core.Composing;
|
||||
using Umbraco.Core.Configuration;
|
||||
using Umbraco.Core.Deploy;
|
||||
using Umbraco.Core.IO;
|
||||
using Umbraco.Core.Logging;
|
||||
using Umbraco.Core.Serialization;
|
||||
using Umbraco.Tests.TestHelpers;
|
||||
|
||||
namespace Umbraco.Tests.CoreThings
|
||||
{
|
||||
@@ -24,7 +16,7 @@ namespace Umbraco.Tests.CoreThings
|
||||
[SetUp]
|
||||
public void SetUp()
|
||||
{
|
||||
UdiParser.ResetUdiTypes();
|
||||
UdiParser.ResetUdiTypes();
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -284,20 +276,20 @@ namespace Umbraco.Tests.CoreThings
|
||||
Assert.IsNull(udi);
|
||||
|
||||
UdiParser.ResetUdiTypes();
|
||||
|
||||
|
||||
// unless we want to know
|
||||
Assert.IsFalse(UdiParser.TryParse("umb://whatever/1234", true, out udi));
|
||||
Assert.AreEqual(Constants.UdiEntityType.Unknown, udi.EntityType);
|
||||
Assert.AreEqual("Umbraco.Core.UnknownTypeUdi", udi.GetType().FullName);
|
||||
|
||||
UdiParser.ResetUdiTypes();
|
||||
|
||||
|
||||
// not known
|
||||
Assert.IsFalse(UdiParser.TryParse("umb://foo/A87F65C8D6B94E868F6949BA92C93045", true, out udi));
|
||||
Assert.AreEqual(Constants.UdiEntityType.Unknown, udi.EntityType);
|
||||
Assert.AreEqual("Umbraco.Core.UnknownTypeUdi", udi.GetType().FullName);
|
||||
|
||||
// scanned
|
||||
// scanned
|
||||
UdiParserServiceConnectors.RegisterServiceConnector<FooConnector>(); // this is the equivalent of scanning but we'll just manually register this one
|
||||
Assert.IsTrue(UdiParser.TryParse("umb://foo/A87F65C8D6B94E868F6949BA92C93045", out udi));
|
||||
Assert.IsInstanceOf<GuidUdi>(udi);
|
||||
|
||||
@@ -5,8 +5,8 @@ using Moq;
|
||||
using NUnit.Framework;
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Core.Cache;
|
||||
using Umbraco.Core.Configuration.UmbracoSettings;
|
||||
using Umbraco.Core.Composing;
|
||||
using Umbraco.Core.Configuration.UmbracoSettings;
|
||||
using Umbraco.Core.IO;
|
||||
using Umbraco.Core.IO.MediaPathSchemes;
|
||||
using Umbraco.Core.Logging;
|
||||
@@ -14,7 +14,7 @@ using Umbraco.Core.Services;
|
||||
using Umbraco.Tests.Components;
|
||||
using Umbraco.Tests.TestHelpers;
|
||||
using Umbraco.Core.Composing.CompositionExtensions;
|
||||
using Umbraco.Core.Strings;
|
||||
using Current = Umbraco.Web.Composing.Current;
|
||||
using FileSystems = Umbraco.Core.IO.FileSystems;
|
||||
|
||||
namespace Umbraco.Tests.IO
|
||||
|
||||
@@ -1,9 +1,6 @@
|
||||
using System;
|
||||
using NUnit.Framework;
|
||||
using Umbraco.Core.IO;
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Core.Composing;
|
||||
using Umbraco.Core.Configuration;
|
||||
using Umbraco.Core.Strings;
|
||||
using Umbraco.Tests.TestHelpers;
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ using Moq;
|
||||
using NUnit.Framework;
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Core.Cache;
|
||||
using Umbraco.Core.Composing;
|
||||
using Umbraco.Web.Composing;
|
||||
using Umbraco.Core.Logging;
|
||||
using Umbraco.Core.Models;
|
||||
using Umbraco.Core.Persistence.Repositories.Implement;
|
||||
@@ -33,7 +33,7 @@ namespace Umbraco.Tests.Integration
|
||||
{
|
||||
base.SetUp();
|
||||
|
||||
_h1 = new DistributedCacheBinder(new DistributedCache(), Mock.Of<IUmbracoContextFactory>(), Mock.Of<ILogger>());
|
||||
_h1 = new DistributedCacheBinder(new DistributedCache(Current.ServerMessenger, Current.CacheRefreshers), Mock.Of<IUmbracoContextFactory>(), Mock.Of<ILogger>());
|
||||
_h1.BindEvents(true);
|
||||
|
||||
_events = new List<EventInstance>();
|
||||
|
||||
@@ -4,8 +4,8 @@ using Umbraco.Core.Models;
|
||||
using Umbraco.Core.Persistence;
|
||||
using Umbraco.Tests.Testing;
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Core.Composing;
|
||||
using Umbraco.Tests.TestHelpers;
|
||||
using Umbraco.Web.Composing;
|
||||
|
||||
namespace Umbraco.Tests.Issues
|
||||
{
|
||||
@@ -22,7 +22,7 @@ namespace Umbraco.Tests.Issues
|
||||
contentType.Name = "test";
|
||||
var propertyType = new PropertyType(ShortStringHelper, "test", ValueStorageType.Ntext, "prop") { Name = "Prop", Description = "", Mandatory = false, SortOrder = 1, DataTypeId = -88 };
|
||||
contentType.PropertyTypeCollection.Add(propertyType);
|
||||
Core.Composing.Current.Services.ContentTypeService.Save(contentType);
|
||||
Current.Services.ContentTypeService.Save(contentType);
|
||||
|
||||
var aliasName = string.Empty;
|
||||
|
||||
|
||||
@@ -37,9 +37,10 @@ namespace Umbraco.Tests.LegacyXmlPublishedCache
|
||||
Func<int, XPathNavigator, IEnumerable<IPublishedContent>> getChildren,
|
||||
Func<DictionaryPublishedContent, string, IPublishedProperty> getProperty,
|
||||
IAppCache appCache,
|
||||
IVariationContextAccessor variationContextAccessor,
|
||||
PublishedContentTypeCache contentTypeCache,
|
||||
XPathNavigator nav,
|
||||
bool fromExamine)
|
||||
bool fromExamine):base(variationContextAccessor)
|
||||
{
|
||||
if (valueDictionary == null) throw new ArgumentNullException(nameof(valueDictionary));
|
||||
if (getParent == null) throw new ArgumentNullException(nameof(getParent));
|
||||
|
||||
@@ -9,6 +9,7 @@ using Umbraco.Core.Cache;
|
||||
using Umbraco.Core.Configuration;
|
||||
using Umbraco.Core.Models.PublishedContent;
|
||||
using Umbraco.Core.Xml;
|
||||
using Umbraco.Tests.TestHelpers;
|
||||
using Umbraco.Web.PublishedCache;
|
||||
using Umbraco.Web.Routing;
|
||||
|
||||
@@ -19,6 +20,7 @@ namespace Umbraco.Tests.LegacyXmlPublishedCache
|
||||
private readonly IAppCache _appCache;
|
||||
private readonly IGlobalSettings _globalSettings;
|
||||
private readonly RoutesCache _routesCache;
|
||||
private readonly IVariationContextAccessor _variationContextAccessor;
|
||||
private readonly IDomainCache _domainCache;
|
||||
private readonly PublishedContentTypeCache _contentTypeCache;
|
||||
|
||||
@@ -34,12 +36,14 @@ namespace Umbraco.Tests.LegacyXmlPublishedCache
|
||||
IGlobalSettings globalSettings,
|
||||
PublishedContentTypeCache contentTypeCache, // a PublishedContentType cache
|
||||
RoutesCache routesCache, // a RoutesCache
|
||||
IVariationContextAccessor variationContextAccessor,
|
||||
string previewToken) // a preview token string (or null if not previewing)
|
||||
: base(previewToken.IsNullOrWhiteSpace() == false)
|
||||
{
|
||||
_appCache = appCache;
|
||||
_globalSettings = globalSettings;
|
||||
_routesCache = routesCache; // may be null for unit-testing
|
||||
_variationContextAccessor = variationContextAccessor;
|
||||
_contentTypeCache = contentTypeCache;
|
||||
_domainCache = domainCache;
|
||||
|
||||
@@ -264,7 +268,7 @@ namespace Umbraco.Tests.LegacyXmlPublishedCache
|
||||
while (hasDomains == false && n != null) // n is null at root
|
||||
{
|
||||
// get the url
|
||||
var urlName = n.UrlSegment();
|
||||
var urlName = n.UrlSegment(TestHelper.VariationContextAccessor);
|
||||
pathParts.Add(urlName);
|
||||
|
||||
// move to parent node
|
||||
@@ -313,13 +317,13 @@ namespace Umbraco.Tests.LegacyXmlPublishedCache
|
||||
|
||||
private IPublishedContent ConvertToDocument(XmlNode xmlNode, bool isPreviewing)
|
||||
{
|
||||
return xmlNode == null ? null : XmlPublishedContent.Get(xmlNode, isPreviewing, _appCache, _contentTypeCache);
|
||||
return xmlNode == null ? null : XmlPublishedContent.Get(xmlNode, isPreviewing, _appCache, _contentTypeCache, _variationContextAccessor);
|
||||
}
|
||||
|
||||
private IEnumerable<IPublishedContent> ConvertToDocuments(XmlNodeList xmlNodes, bool isPreviewing)
|
||||
{
|
||||
return xmlNodes.Cast<XmlNode>()
|
||||
.Select(xmlNode => XmlPublishedContent.Get(xmlNode, isPreviewing, _appCache, _contentTypeCache));
|
||||
.Select(xmlNode => XmlPublishedContent.Get(xmlNode, isPreviewing, _appCache, _contentTypeCache, _variationContextAccessor));
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -42,13 +42,14 @@ namespace Umbraco.Tests.LegacyXmlPublishedCache
|
||||
private readonly PublishedContentTypeCache _contentTypeCache;
|
||||
private readonly IEntityXmlSerializer _entitySerializer;
|
||||
private readonly IUmbracoContextAccessor _umbracoContextAccessor;
|
||||
private readonly IVariationContextAccessor _variationContextAccessor;
|
||||
|
||||
// must be specified by the ctor
|
||||
private readonly IAppCache _appCache;
|
||||
|
||||
public PublishedMediaCache(XmlStore xmlStore, IMediaService mediaService, IUserService userService,
|
||||
IAppCache appCache, PublishedContentTypeCache contentTypeCache, IEntityXmlSerializer entitySerializer,
|
||||
IUmbracoContextAccessor umbracoContextAccessor)
|
||||
IUmbracoContextAccessor umbracoContextAccessor, IVariationContextAccessor variationContextAccessor)
|
||||
: base(false)
|
||||
{
|
||||
_mediaService = mediaService ?? throw new ArgumentNullException(nameof(mediaService));
|
||||
@@ -59,6 +60,7 @@ namespace Umbraco.Tests.LegacyXmlPublishedCache
|
||||
_contentTypeCache = contentTypeCache;
|
||||
_entitySerializer = entitySerializer;
|
||||
_umbracoContextAccessor = umbracoContextAccessor;
|
||||
_variationContextAccessor = variationContextAccessor;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -672,6 +674,7 @@ namespace Umbraco.Tests.LegacyXmlPublishedCache
|
||||
GetChildrenMedia,
|
||||
GetProperty,
|
||||
_appCache,
|
||||
_variationContextAccessor,
|
||||
_contentTypeCache,
|
||||
cacheValues.XPath, // though, outside of tests, that should be null
|
||||
cacheValues.FromExamine
|
||||
|
||||
@@ -1,11 +1,9 @@
|
||||
using System;
|
||||
using System.Text;
|
||||
using System.Text;
|
||||
using System.Xml.XPath;
|
||||
using Umbraco.Core.Cache;
|
||||
using Umbraco.Core.Composing;
|
||||
using Umbraco.Web.Composing;
|
||||
using Umbraco.Core.Models;
|
||||
using Umbraco.Core.Models.PublishedContent;
|
||||
using Umbraco.Core.Security;
|
||||
using Umbraco.Core.Services;
|
||||
using Umbraco.Web.PublishedCache;
|
||||
using Umbraco.Web.Security;
|
||||
@@ -19,14 +17,16 @@ namespace Umbraco.Tests.LegacyXmlPublishedCache
|
||||
private readonly XmlStore _xmlStore;
|
||||
private readonly PublishedContentTypeCache _contentTypeCache;
|
||||
private readonly IUserService _userService;
|
||||
private readonly IVariationContextAccessor _variationContextAccessor;
|
||||
|
||||
public PublishedMemberCache(XmlStore xmlStore, IAppCache requestCache, IMemberService memberService, PublishedContentTypeCache contentTypeCache, IUserService userService)
|
||||
public PublishedMemberCache(XmlStore xmlStore, IAppCache requestCache, IMemberService memberService, PublishedContentTypeCache contentTypeCache, IUserService userService, IVariationContextAccessor variationContextAccessor)
|
||||
{
|
||||
_requestCache = requestCache;
|
||||
_memberService = memberService;
|
||||
_xmlStore = xmlStore;
|
||||
_contentTypeCache = contentTypeCache;
|
||||
_userService = userService;
|
||||
_variationContextAccessor = variationContextAccessor;
|
||||
}
|
||||
|
||||
public IPublishedContent GetByProviderKey(object key)
|
||||
@@ -39,7 +39,7 @@ namespace Umbraco.Tests.LegacyXmlPublishedCache
|
||||
var result = _memberService.GetByProviderKey(key);
|
||||
if (result == null) return null;
|
||||
var type = _contentTypeCache.Get(PublishedItemType.Member, result.ContentTypeId);
|
||||
return new PublishedMember(result, type, _userService).CreateModel(Current.PublishedModelFactory);
|
||||
return new PublishedMember(result, type, _userService, _variationContextAccessor).CreateModel(Current.PublishedModelFactory);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -53,7 +53,7 @@ namespace Umbraco.Tests.LegacyXmlPublishedCache
|
||||
var result = _memberService.GetById(memberId);
|
||||
if (result == null) return null;
|
||||
var type = _contentTypeCache.Get(PublishedItemType.Member, result.ContentTypeId);
|
||||
return new PublishedMember(result, type, _userService).CreateModel(Current.PublishedModelFactory);
|
||||
return new PublishedMember(result, type, _userService, _variationContextAccessor).CreateModel(Current.PublishedModelFactory);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -67,7 +67,7 @@ namespace Umbraco.Tests.LegacyXmlPublishedCache
|
||||
var result = _memberService.GetByUsername(username);
|
||||
if (result == null) return null;
|
||||
var type = _contentTypeCache.Get(PublishedItemType.Member, result.ContentTypeId);
|
||||
return new PublishedMember(result, type, _userService).CreateModel(Current.PublishedModelFactory);
|
||||
return new PublishedMember(result, type, _userService, _variationContextAccessor).CreateModel(Current.PublishedModelFactory);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -81,14 +81,14 @@ namespace Umbraco.Tests.LegacyXmlPublishedCache
|
||||
var result = _memberService.GetByEmail(email);
|
||||
if (result == null) return null;
|
||||
var type = _contentTypeCache.Get(PublishedItemType.Member, result.ContentTypeId);
|
||||
return new PublishedMember(result, type, _userService).CreateModel(Current.PublishedModelFactory);
|
||||
return new PublishedMember(result, type, _userService, _variationContextAccessor).CreateModel(Current.PublishedModelFactory);
|
||||
});
|
||||
}
|
||||
|
||||
public IPublishedContent GetByMember(IMember member)
|
||||
{
|
||||
var type = _contentTypeCache.Get(PublishedItemType.Member, member.ContentTypeId);
|
||||
return new PublishedMember(member, type, _userService).CreateModel(Current.PublishedModelFactory);
|
||||
return new PublishedMember(member, type, _userService, _variationContextAccessor).CreateModel(Current.PublishedModelFactory);
|
||||
}
|
||||
|
||||
public XPathNavigator CreateNavigator()
|
||||
|
||||
@@ -26,19 +26,22 @@ namespace Umbraco.Tests.LegacyXmlPublishedCache
|
||||
XmlNode xmlNode,
|
||||
bool isPreviewing,
|
||||
IAppCache appCache,
|
||||
PublishedContentTypeCache contentTypeCache)
|
||||
PublishedContentTypeCache contentTypeCache,
|
||||
IVariationContextAccessor variationContextAccessor): base(variationContextAccessor)
|
||||
{
|
||||
_xmlNode = xmlNode;
|
||||
_isPreviewing = isPreviewing;
|
||||
|
||||
_appCache = appCache;
|
||||
_contentTypeCache = contentTypeCache;
|
||||
_variationContextAccessor = variationContextAccessor;
|
||||
}
|
||||
|
||||
private readonly XmlNode _xmlNode;
|
||||
private readonly bool _isPreviewing;
|
||||
private readonly IAppCache _appCache; // at snapshot/request level (see PublishedContentCache)
|
||||
private readonly PublishedContentTypeCache _contentTypeCache;
|
||||
private readonly IVariationContextAccessor _variationContextAccessor;
|
||||
|
||||
private readonly object _initializeLock = new object();
|
||||
|
||||
@@ -272,7 +275,7 @@ namespace Umbraco.Tests.LegacyXmlPublishedCache
|
||||
if (parent == null) return;
|
||||
|
||||
if (parent.Attributes?.GetNamedItem("isDoc") != null)
|
||||
_parent = Get(parent, _isPreviewing, _appCache, _contentTypeCache);
|
||||
_parent = Get(parent, _isPreviewing, _appCache, _contentTypeCache, _variationContextAccessor);
|
||||
|
||||
_parentInitialized = true;
|
||||
}
|
||||
@@ -429,7 +432,7 @@ namespace Umbraco.Tests.LegacyXmlPublishedCache
|
||||
var iterator = nav.Select(expr);
|
||||
|
||||
_children = iterator.Cast<XPathNavigator>()
|
||||
.Select(n => Get(((IHasXmlNode) n).GetNode(), _isPreviewing, _appCache, _contentTypeCache))
|
||||
.Select(n => Get(((IHasXmlNode) n).GetNode(), _isPreviewing, _appCache, _contentTypeCache, _variationContextAccessor))
|
||||
.OrderBy(x => x.SortOrder)
|
||||
.ToList();
|
||||
|
||||
@@ -444,12 +447,13 @@ namespace Umbraco.Tests.LegacyXmlPublishedCache
|
||||
/// <param name="appCache">A cache.</param>
|
||||
/// <param name="contentTypeCache">A content type cache.</param>
|
||||
/// <param name="umbracoContextAccessor">A umbraco context accessor</param>
|
||||
/// <param name="variationContextAccessor"></param>
|
||||
/// <returns>The IPublishedContent corresponding to the Xml cache node.</returns>
|
||||
/// <remarks>Maintains a per-request cache of IPublishedContent items in order to make
|
||||
/// sure that we create only one instance of each for the duration of a request. The
|
||||
/// returned IPublishedContent is a model, if models are enabled.</remarks>
|
||||
public static IPublishedContent Get(XmlNode node, bool isPreviewing, IAppCache appCache,
|
||||
PublishedContentTypeCache contentTypeCache)
|
||||
PublishedContentTypeCache contentTypeCache, IVariationContextAccessor variationContextAccessor)
|
||||
{
|
||||
// only 1 per request
|
||||
|
||||
@@ -457,7 +461,7 @@ namespace Umbraco.Tests.LegacyXmlPublishedCache
|
||||
var id = attrs?.GetNamedItem("id").Value;
|
||||
if (id.IsNullOrWhiteSpace()) throw new InvalidOperationException("Node has no ID attribute.");
|
||||
var key = CacheKeyPrefix + id; // dont bother with preview, wont change during request in Xml cache
|
||||
return (IPublishedContent) appCache.Get(key, () => (new XmlPublishedContent(node, isPreviewing, appCache, contentTypeCache)).CreateModel(Current.PublishedModelFactory));
|
||||
return (IPublishedContent) appCache.Get(key, () => (new XmlPublishedContent(node, isPreviewing, appCache, contentTypeCache, variationContextAccessor)).CreateModel(Current.PublishedModelFactory));
|
||||
}
|
||||
|
||||
public static void ClearRequest()
|
||||
|
||||
@@ -38,6 +38,7 @@ namespace Umbraco.Tests.LegacyXmlPublishedCache
|
||||
private readonly IDefaultCultureAccessor _defaultCultureAccessor;
|
||||
private readonly ISiteDomainHelper _siteDomainHelper;
|
||||
private readonly IEntityXmlSerializer _entitySerializer;
|
||||
private readonly IVariationContextAccessor _variationContextAccessor;
|
||||
private readonly IUmbracoContextAccessor _umbracoContextAccessor;
|
||||
private readonly IHostingEnvironment _hostingEnvironment;
|
||||
|
||||
@@ -58,6 +59,7 @@ namespace Umbraco.Tests.LegacyXmlPublishedCache
|
||||
IShortStringHelper shortStringHelper,
|
||||
ISiteDomainHelper siteDomainHelper,
|
||||
IEntityXmlSerializer entitySerializer,
|
||||
|
||||
MainDom mainDom,
|
||||
bool testing = false, bool enableRepositoryEvents = true)
|
||||
: this(serviceContext, publishedContentTypeFactory, scopeProvider, requestCache,
|
||||
@@ -103,7 +105,7 @@ namespace Umbraco.Tests.LegacyXmlPublishedCache
|
||||
_mediaService = serviceContext.MediaService;
|
||||
_userService = serviceContext.UserService;
|
||||
_defaultCultureAccessor = defaultCultureAccessor;
|
||||
|
||||
_variationContextAccessor = variationContextAccessor;
|
||||
_requestCache = requestCache;
|
||||
_umbracoContextAccessor = umbracoContextAccessor;
|
||||
_globalSettings = globalSettings;
|
||||
@@ -153,9 +155,9 @@ namespace Umbraco.Tests.LegacyXmlPublishedCache
|
||||
var domainCache = new DomainCache(_domainService, _defaultCultureAccessor);
|
||||
|
||||
return new PublishedSnapshot(
|
||||
new PublishedContentCache(_xmlStore, domainCache, _requestCache, _globalSettings, _contentTypeCache, _routesCache, previewToken),
|
||||
new PublishedMediaCache(_xmlStore, _mediaService, _userService, _requestCache, _contentTypeCache, _entitySerializer, _umbracoContextAccessor),
|
||||
new PublishedMemberCache(_xmlStore, _requestCache, _memberService, _contentTypeCache, _userService),
|
||||
new PublishedContentCache(_xmlStore, domainCache, _requestCache, _globalSettings, _contentTypeCache, _routesCache,_variationContextAccessor, previewToken),
|
||||
new PublishedMediaCache(_xmlStore, _mediaService, _userService, _requestCache, _contentTypeCache, _entitySerializer, _umbracoContextAccessor, _variationContextAccessor),
|
||||
new PublishedMemberCache(_xmlStore, _requestCache, _memberService, _contentTypeCache, _userService, _variationContextAccessor),
|
||||
domainCache);
|
||||
}
|
||||
|
||||
|
||||
@@ -4,8 +4,6 @@ using System;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Core.Composing;
|
||||
using Umbraco.Core.IO;
|
||||
using Umbraco.Core.Logging.Viewer;
|
||||
using Umbraco.Tests.TestHelpers;
|
||||
|
||||
|
||||
@@ -3,7 +3,6 @@ using NUnit.Framework;
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Core.Cache;
|
||||
using Umbraco.Core.Composing;
|
||||
using Umbraco.Core.Configuration;
|
||||
using Umbraco.Core.Logging;
|
||||
using Umbraco.Core.Models;
|
||||
using Umbraco.Tests.TestHelpers;
|
||||
@@ -24,11 +23,6 @@ namespace Umbraco.Tests.Macros
|
||||
new ObjectCacheAppCache(typeFinder),
|
||||
NoAppCache.Instance,
|
||||
new IsolatedCaches(type => new ObjectCacheAppCache(typeFinder)));
|
||||
//Current.ApplicationContext = new ApplicationContext(cacheHelper, new ProfilingLogger(Mock.Of<ILogger>(), Mock.Of<IProfiler>()));
|
||||
|
||||
Current.Reset();
|
||||
Current.UnlockConfigs(TestHelper.GetConfigsFactory(), TestHelper.IOHelper);
|
||||
Current.Configs.Add(SettingsForTests.GetDefaultUmbracoSettings);
|
||||
}
|
||||
|
||||
[TestCase("PartialView", true)]
|
||||
|
||||
@@ -6,14 +6,12 @@ using NUnit.Framework;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using Umbraco.Core.Cache;
|
||||
using Umbraco.Core.Composing;
|
||||
using Umbraco.Core.Logging;
|
||||
using Umbraco.Core.Manifest;
|
||||
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;
|
||||
|
||||
@@ -10,7 +10,6 @@ using Umbraco.Core.Models;
|
||||
using Umbraco.Core.PropertyEditors;
|
||||
using Umbraco.Core.Services;
|
||||
using Umbraco.Core.Services.Implement;
|
||||
using Umbraco.Tests.TestHelpers;
|
||||
using Umbraco.Tests.TestHelpers.Entities;
|
||||
using Umbraco.Tests.Testing;
|
||||
using Umbraco.Web.PropertyEditors;
|
||||
|
||||
@@ -2,8 +2,6 @@
|
||||
using System.Xml.Linq;
|
||||
using NUnit.Framework;
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Core.Composing;
|
||||
using Umbraco.Core.Models;
|
||||
using Umbraco.Core.Services;
|
||||
using Umbraco.Core.Strings;
|
||||
using Umbraco.Tests.TestHelpers;
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using NUnit.Framework;
|
||||
using Umbraco.Core.Composing;
|
||||
using Umbraco.Core.Configuration;
|
||||
using Umbraco.Core.Models;
|
||||
using Umbraco.Core.Models.Entities;
|
||||
using Umbraco.Tests.TestHelpers;
|
||||
@@ -12,14 +10,6 @@ namespace Umbraco.Tests.Models
|
||||
[TestFixture]
|
||||
public class MacroTests
|
||||
{
|
||||
[SetUp]
|
||||
public void Init()
|
||||
{
|
||||
Current.Reset();
|
||||
Current.UnlockConfigs(TestHelper.GetConfigsFactory(), TestHelper.IOHelper);
|
||||
Current.Configs.Add(SettingsForTests.GetDefaultUmbracoSettings);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Can_Deep_Clone()
|
||||
{
|
||||
|
||||
@@ -6,7 +6,6 @@ using Umbraco.Core;
|
||||
using Umbraco.Core.Composing.CompositionExtensions;
|
||||
using Umbraco.Core.Configuration.UmbracoSettings;
|
||||
using Umbraco.Core.Services;
|
||||
using Umbraco.Core.Dictionary;
|
||||
using Umbraco.Core.Logging;
|
||||
using Umbraco.Core.Models;
|
||||
using Umbraco.Core.PropertyEditors;
|
||||
|
||||
@@ -36,7 +36,7 @@ namespace Umbraco.Tests.Models
|
||||
var localizationService = Mock.Of<ILocalizationService>();
|
||||
|
||||
var mediaFileSystem = new MediaFileSystem(Mock.Of<IFileSystem>(), scheme, logger, ShortStringHelper);
|
||||
var ignored = new FileUploadPropertyEditor(Mock.Of<ILogger>(), mediaFileSystem, config, dataTypeService, localizationService, ShortStringHelper);
|
||||
var ignored = new FileUploadPropertyEditor(Mock.Of<ILogger>(), mediaFileSystem, config, DataTypeService, LocalizationService, LocalizedTextService, ShortStringHelper);
|
||||
|
||||
var media = MockedMedia.CreateMediaImage(mediaType, -1);
|
||||
media.WriterId = -1; // else it's zero and that's not a user and it breaks the tests
|
||||
|
||||
@@ -13,15 +13,6 @@ namespace Umbraco.Tests.Models
|
||||
[TestFixture]
|
||||
public class MemberTests
|
||||
{
|
||||
[SetUp]
|
||||
public void Setup()
|
||||
{
|
||||
Current.Reset();
|
||||
Current.UnlockConfigs(TestHelper.GetConfigsFactory(), TestHelper.IOHelper);
|
||||
Current.Configs.Add(SettingsForTests.GetDefaultGlobalSettings);
|
||||
Current.Configs.Add(SettingsForTests.GetDefaultUmbracoSettings);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Can_Deep_Clone()
|
||||
{
|
||||
|
||||
@@ -14,15 +14,7 @@ namespace Umbraco.Tests.Models
|
||||
[TestFixture]
|
||||
public class UserTests
|
||||
{
|
||||
private IGlobalSettings GlobalSettings { get; } = SettingsForTests.GenerateMockGlobalSettings();
|
||||
|
||||
[SetUp]
|
||||
public void Setup()
|
||||
{
|
||||
Current.Reset();
|
||||
Current.UnlockConfigs(TestHelper.GetConfigsFactory(), TestHelper.IOHelper);
|
||||
Current.Configs.Add(SettingsForTests.GetDefaultGlobalSettings);
|
||||
}
|
||||
private IGlobalSettings GlobalSettings { get; } = SettingsForTests.GetDefaultGlobalSettings();
|
||||
|
||||
[Test]
|
||||
public void Can_Deep_Clone()
|
||||
|
||||
@@ -1,23 +1,23 @@
|
||||
using System;
|
||||
using Moq;
|
||||
using NUnit.Framework;
|
||||
using NUnit.Framework.Internal;
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Core.Composing;
|
||||
using Umbraco.Core.Configuration;
|
||||
using Umbraco.Core.Models;
|
||||
using Umbraco.Core.PropertyEditors;
|
||||
using Umbraco.Core.Services;
|
||||
using Umbraco.Core.Services.Implement;
|
||||
using Umbraco.Core.Strings;
|
||||
using Umbraco.Tests.TestHelpers;
|
||||
using ILogger = Umbraco.Core.Logging.ILogger;
|
||||
using Current = Umbraco.Web.Composing.Current;
|
||||
|
||||
namespace Umbraco.Tests.Models
|
||||
{
|
||||
[TestFixture]
|
||||
public class VariationTests
|
||||
{
|
||||
private IFactory _factory;
|
||||
private IShortStringHelper ShortStringHelper { get; } = TestHelper.ShortStringHelper;
|
||||
|
||||
[SetUp]
|
||||
@@ -37,8 +37,7 @@ namespace Umbraco.Tests.Models
|
||||
configs.Add(SettingsForTests.GetDefaultGlobalSettings);
|
||||
configs.Add(SettingsForTests.GetDefaultUmbracoSettings);
|
||||
|
||||
var factory = Mock.Of<IFactory>();
|
||||
Current.Factory = factory;
|
||||
_factory = Mock.Of<IFactory>();
|
||||
|
||||
var dataTypeService = Mock.Of<IDataTypeService>();
|
||||
var localizationService = Mock.Of<ILocalizationService>();
|
||||
@@ -62,7 +61,7 @@ namespace Umbraco.Tests.Models
|
||||
dataTypeService: dataTypeService,
|
||||
localizedTextService: Mock.Of<ILocalizedTextService>());
|
||||
|
||||
Mock.Get(factory)
|
||||
Mock.Get(_factory)
|
||||
.Setup(x => x.GetInstance(It.IsAny<Type>()))
|
||||
.Returns<Type>(x =>
|
||||
{
|
||||
@@ -449,7 +448,7 @@ namespace Umbraco.Tests.Models
|
||||
[Test]
|
||||
public void ContentPublishValuesWithMixedPropertyTypeVariations()
|
||||
{
|
||||
var propertyValidationService = new PropertyValidationService(Current.Factory.GetInstance<PropertyEditorCollection>(), Current.Factory.GetInstance<ServiceContext>().DataTypeService);
|
||||
var propertyValidationService = new PropertyValidationService(_factory.GetInstance<PropertyEditorCollection>(), _factory.GetInstance<ServiceContext>().DataTypeService);
|
||||
const string langFr = "fr-FR";
|
||||
|
||||
// content type varies by Culture
|
||||
@@ -581,7 +580,7 @@ namespace Umbraco.Tests.Models
|
||||
prop.SetValue("a");
|
||||
Assert.AreEqual("a", prop.GetValue());
|
||||
Assert.IsNull(prop.GetValue(published: true));
|
||||
var propertyValidationService = new PropertyValidationService(Current.Factory.GetInstance<PropertyEditorCollection>(), Current.Factory.GetInstance<ServiceContext>().DataTypeService);
|
||||
var propertyValidationService = new PropertyValidationService(_factory.GetInstance<PropertyEditorCollection>(), _factory.GetInstance<ServiceContext>().DataTypeService);
|
||||
|
||||
Assert.IsTrue(propertyValidationService.IsPropertyValid(prop));
|
||||
|
||||
|
||||
@@ -150,8 +150,8 @@ namespace Umbraco.Tests.Packaging
|
||||
{
|
||||
var file1 = $"~/{_testBaseFolder}/App_Plugins/MyPlugin/package.manifest";
|
||||
var file2 = $"~/{_testBaseFolder}/App_Plugins/MyPlugin/styles.css";
|
||||
var mappedFile1 = Current.IOHelper.MapPath(file1);
|
||||
var mappedFile2 = Current.IOHelper.MapPath(file2);
|
||||
var mappedFile1 = IOHelper.MapPath(file1);
|
||||
var mappedFile2 = IOHelper.MapPath(file2);
|
||||
Directory.CreateDirectory(Path.GetDirectoryName(mappedFile1));
|
||||
Directory.CreateDirectory(Path.GetDirectoryName(mappedFile2));
|
||||
File.WriteAllText(mappedFile1, "hello world");
|
||||
@@ -175,7 +175,7 @@ namespace Umbraco.Tests.Packaging
|
||||
def = PackageBuilder.GetById(def.Id); //re-get
|
||||
Assert.IsNotNull(def.PackagePath);
|
||||
|
||||
using (var archive = ZipFile.OpenRead(Current.IOHelper.MapPath(zip)))
|
||||
using (var archive = ZipFile.OpenRead(IOHelper.MapPath(zip)))
|
||||
{
|
||||
Assert.AreEqual(3, archive.Entries.Count);
|
||||
|
||||
|
||||
@@ -36,9 +36,9 @@ namespace Umbraco.Tests.Persistence.Repositories
|
||||
using (provider.CreateScope())
|
||||
{
|
||||
var dtRepo = CreateRepository();
|
||||
IDataType dataType1 = new DataType(new RadioButtonsPropertyEditor(Logger, ServiceContext.TextService, IOHelper, ShortStringHelper)) { Name = "dt1" };
|
||||
IDataType dataType1 = new DataType(new RadioButtonsPropertyEditor(Logger, IOHelper, DataTypeService, LocalizationService, LocalizedTextService, ShortStringHelper)) { Name = "dt1" };
|
||||
dtRepo.Save(dataType1);
|
||||
IDataType dataType2 = new DataType(new RadioButtonsPropertyEditor(Logger, ServiceContext.TextService, IOHelper, ShortStringHelper)) { Name = "dt2" };
|
||||
IDataType dataType2 = new DataType(new RadioButtonsPropertyEditor(Logger, IOHelper, DataTypeService, LocalizationService, LocalizedTextService, ShortStringHelper)) { Name = "dt2" };
|
||||
dtRepo.Save(dataType2);
|
||||
|
||||
var ctRepo = Factory.GetInstance<IContentTypeRepository>();
|
||||
@@ -106,14 +106,14 @@ namespace Umbraco.Tests.Persistence.Repositories
|
||||
var container2 = new EntityContainer(Constants.ObjectTypes.DataType) { Name = "blah2", ParentId = container1.Id };
|
||||
containerRepository.Save(container2);
|
||||
|
||||
var dataType = (IDataType) new DataType(new RadioButtonsPropertyEditor(Logger, ServiceContext.TextService, IOHelper, ShortStringHelper), container2.Id)
|
||||
var dataType = (IDataType) new DataType(new RadioButtonsPropertyEditor(Logger, IOHelper, DataTypeService, LocalizationService, LocalizedTextService, ShortStringHelper), container2.Id)
|
||||
{
|
||||
Name = "dt1"
|
||||
};
|
||||
repository.Save(dataType);
|
||||
|
||||
//create a
|
||||
var dataType2 = (IDataType)new DataType(new RadioButtonsPropertyEditor(Logger, ServiceContext.TextService, IOHelper, ShortStringHelper), dataType.Id)
|
||||
var dataType2 = (IDataType)new DataType(new RadioButtonsPropertyEditor(Logger, IOHelper, DataTypeService, LocalizationService, LocalizedTextService, ShortStringHelper), dataType.Id)
|
||||
{
|
||||
Name = "dt2"
|
||||
};
|
||||
@@ -185,7 +185,7 @@ namespace Umbraco.Tests.Persistence.Repositories
|
||||
var container = new EntityContainer(Constants.ObjectTypes.DataType) { Name = "blah" };
|
||||
containerRepository.Save(container);
|
||||
|
||||
var dataTypeDefinition = new DataType(new RadioButtonsPropertyEditor(Logger, ServiceContext.TextService, IOHelper, ShortStringHelper), container.Id) { Name = "test" };
|
||||
var dataTypeDefinition = new DataType(new RadioButtonsPropertyEditor(Logger, IOHelper, DataTypeService, LocalizationService, LocalizedTextService, ShortStringHelper), container.Id) { Name = "test" };
|
||||
repository.Save(dataTypeDefinition);
|
||||
|
||||
Assert.AreEqual(container.Id, dataTypeDefinition.ParentId);
|
||||
@@ -205,7 +205,7 @@ namespace Umbraco.Tests.Persistence.Repositories
|
||||
var container = new EntityContainer(Constants.ObjectTypes.DataType) { Name = "blah" };
|
||||
containerRepository.Save(container);
|
||||
|
||||
IDataType dataType = new DataType(new RadioButtonsPropertyEditor(Logger, ServiceContext.TextService, IOHelper, ShortStringHelper), container.Id) { Name = "test" };
|
||||
IDataType dataType = new DataType(new RadioButtonsPropertyEditor(Logger, IOHelper, DataTypeService, LocalizationService, LocalizedTextService, ShortStringHelper), container.Id) { Name = "test" };
|
||||
repository.Save(dataType);
|
||||
|
||||
// Act
|
||||
@@ -228,7 +228,7 @@ namespace Umbraco.Tests.Persistence.Repositories
|
||||
using (provider.CreateScope())
|
||||
{
|
||||
var repository = CreateRepository();
|
||||
IDataType dataType = new DataType(new RadioButtonsPropertyEditor(Logger, ServiceContext.TextService, IOHelper, ShortStringHelper)) {Name = "test"};
|
||||
IDataType dataType = new DataType(new RadioButtonsPropertyEditor(Logger, IOHelper, DataTypeService, LocalizationService, LocalizedTextService, ShortStringHelper)) {Name = "test"};
|
||||
|
||||
repository.Save(dataType);
|
||||
|
||||
|
||||
@@ -359,7 +359,7 @@ namespace Umbraco.Tests.Persistence.Repositories
|
||||
{
|
||||
var repository = CreateRepository((IScopeAccessor)provider, out var contentTypeRepository, out DataTypeRepository dataTypeDefinitionRepository);
|
||||
|
||||
var editor = new DecimalPropertyEditor(Logger, ShortStringHelper);
|
||||
var editor = new DecimalPropertyEditor(Logger, DataTypeService, LocalizationService, LocalizedTextService, ShortStringHelper);
|
||||
var dtd = new DataType(editor) { Name = "test", DatabaseType = ValueStorageType.Decimal };
|
||||
dataTypeDefinitionRepository.Save(dtd);
|
||||
|
||||
|
||||
@@ -7,7 +7,6 @@ using Newtonsoft.Json.Linq;
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Core.Cache;
|
||||
using Umbraco.Core.Composing;
|
||||
using Umbraco.Core.Configuration;
|
||||
using Umbraco.Core.Configuration.UmbracoSettings;
|
||||
using Umbraco.Core.IO;
|
||||
using Umbraco.Core.Logging;
|
||||
@@ -22,6 +21,7 @@ using Umbraco.Tests.TestHelpers;
|
||||
using Umbraco.Web.Models;
|
||||
using Umbraco.Web;
|
||||
using Umbraco.Web.PropertyEditors;
|
||||
using Current = Umbraco.Web.Composing.Current;
|
||||
|
||||
namespace Umbraco.Tests.PropertyEditors
|
||||
{
|
||||
|
||||
@@ -8,10 +8,10 @@ using Umbraco.Core.Composing;
|
||||
using Umbraco.Core.Logging;
|
||||
using Umbraco.Core.Models;
|
||||
using Umbraco.Core.PropertyEditors;
|
||||
using Umbraco.Core.Services;
|
||||
using Umbraco.Core.Strings;
|
||||
using Umbraco.Tests.Components;
|
||||
using Umbraco.Tests.TestHelpers;
|
||||
using Current = Umbraco.Web.Composing.Current;
|
||||
|
||||
namespace Umbraco.Tests.PropertyEditors
|
||||
{
|
||||
|
||||
@@ -178,7 +178,7 @@ namespace Umbraco.Tests.Published
|
||||
[Test]
|
||||
public void SimpleConverter3Test()
|
||||
{
|
||||
Current.Reset();
|
||||
// Current.Reset();
|
||||
var register = TestHelper.GetRegister();
|
||||
|
||||
var composition = new Composition(register, TestHelper.GetMockedTypeLoader(), Mock.Of<IProfilingLogger>(), ComponentTests.MockRuntimeState(RuntimeLevel.Run), TestHelper.GetConfigs(), TestHelper.IOHelper, AppCaches.NoCache);
|
||||
@@ -194,7 +194,7 @@ namespace Umbraco.Tests.Published
|
||||
});
|
||||
register.Register(f => factory);
|
||||
|
||||
Current.Factory = composition.CreateFactory();
|
||||
var registerFactory = composition.CreateFactory();
|
||||
|
||||
var cacheMock = new Mock<IPublishedContentCache>();
|
||||
var cacheContent = new Dictionary<int, IPublishedContent>();
|
||||
@@ -205,7 +205,7 @@ namespace Umbraco.Tests.Published
|
||||
publishedSnapshotAccessorMock.Setup(x => x.PublishedSnapshot).Returns(publishedSnapshotMock.Object);
|
||||
register.Register(f => publishedSnapshotAccessorMock.Object);
|
||||
|
||||
var converters = Current.Factory.GetInstance<PropertyValueConverterCollection>();
|
||||
var converters = registerFactory.GetInstance<PropertyValueConverterCollection>();
|
||||
|
||||
var dataTypeService = new TestObjects.TestDataTypeService(
|
||||
new DataType(new VoidEditor(Mock.Of<ILogger>(), Mock.Of<IDataTypeService>(), Mock.Of<ILocalizationService>(),Mock.Of<ILocalizedTextService>(), Mock.Of<IShortStringHelper>())) { Id = 1 },
|
||||
@@ -236,8 +236,9 @@ namespace Umbraco.Tests.Published
|
||||
Properties = new[] { new SolidPublishedProperty { Alias = "prop2", SolidHasValue = true, SolidValue = "1003" } }
|
||||
};
|
||||
|
||||
cacheContent[cnt1.Id] = cnt1.CreateModel(Current.PublishedModelFactory);
|
||||
cacheContent[cnt2.Id] = cnt2.CreateModel(Current.PublishedModelFactory);
|
||||
var publishedModelFactory = registerFactory.GetInstance<IPublishedModelFactory>();
|
||||
cacheContent[cnt1.Id] = cnt1.CreateModel(publishedModelFactory);
|
||||
cacheContent[cnt2.Id] = cnt2.CreateModel(publishedModelFactory);
|
||||
|
||||
// can get the actual property Clr type
|
||||
// ie ModelType gets properly mapped by IPublishedContentModelFactory
|
||||
|
||||
@@ -5,8 +5,7 @@ using System.Linq;
|
||||
using Moq;
|
||||
using NUnit.Framework;
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Core.Composing;
|
||||
using Umbraco.Core.Exceptions;
|
||||
using Umbraco.Web.Composing;
|
||||
using Umbraco.Core.Logging;
|
||||
using Umbraco.Core.Models;
|
||||
using Umbraco.Core.Models.PublishedContent;
|
||||
@@ -15,7 +14,6 @@ using Umbraco.Core.Services;
|
||||
using Umbraco.Tests.PublishedContent;
|
||||
using Umbraco.Tests.TestHelpers;
|
||||
using Umbraco.Web;
|
||||
using Umbraco.Web.Models;
|
||||
using Umbraco.Web.PropertyEditors;
|
||||
using Umbraco.Web.PropertyEditors.ValueConverters;
|
||||
using Umbraco.Web.PublishedCache;
|
||||
|
||||
@@ -27,6 +27,7 @@ using Umbraco.Web.Cache;
|
||||
using Umbraco.Web.PublishedCache;
|
||||
using Umbraco.Web.PublishedCache.NuCache;
|
||||
using Umbraco.Web.PublishedCache.NuCache.DataSource;
|
||||
using Current = Umbraco.Web.Composing.Current;
|
||||
|
||||
namespace Umbraco.Tests.PublishedContent
|
||||
{
|
||||
@@ -34,6 +35,7 @@ namespace Umbraco.Tests.PublishedContent
|
||||
public class NuCacheChildrenTests
|
||||
{
|
||||
private IPublishedModelFactory PublishedModelFactory { get; } = new NoopPublishedModelFactory();
|
||||
private IVariationContextAccessor VariationContextAccessor { get; } = TestHelper.VariationContextAccessor;
|
||||
|
||||
private IPublishedSnapshotService _snapshotService;
|
||||
private IVariationContextAccessor _variationAccesor;
|
||||
@@ -128,7 +130,7 @@ namespace Umbraco.Tests.PublishedContent
|
||||
|
||||
// create a published content type factory
|
||||
var contentTypeFactory = new PublishedContentTypeFactory(
|
||||
Mock.Of<IPublishedModelFactory>(),
|
||||
PublishedModelFactory,
|
||||
new PropertyValueConverterCollection(Array.Empty<IPropertyValueConverter>()),
|
||||
dataTypeService);
|
||||
|
||||
@@ -160,7 +162,7 @@ namespace Umbraco.Tests.PublishedContent
|
||||
_source,
|
||||
globalSettings,
|
||||
Mock.Of<IEntityXmlSerializer>(),
|
||||
Mock.Of<IPublishedModelFactory>(),
|
||||
PublishedModelFactory,
|
||||
new UrlSegmentProviderCollection(new[] { new DefaultUrlSegmentProvider(TestHelper.ShortStringHelper) }),
|
||||
typeFinder,
|
||||
hostingEnvironment,
|
||||
@@ -400,19 +402,19 @@ namespace Umbraco.Tests.PublishedContent
|
||||
var documents = snapshot.Content.GetAtRoot().ToArray();
|
||||
AssertDocuments(documents, "N1", "N2", "N3");
|
||||
|
||||
documents = snapshot.Content.GetById(1).Children().ToArray();
|
||||
documents = snapshot.Content.GetById(1).Children(_variationAccesor).ToArray();
|
||||
AssertDocuments(documents, "N4", "N5", "N6");
|
||||
|
||||
documents = snapshot.Content.GetById(2).Children().ToArray();
|
||||
documents = snapshot.Content.GetById(2).Children(_variationAccesor).ToArray();
|
||||
AssertDocuments(documents, "N9", "N8", "N7");
|
||||
|
||||
documents = snapshot.Content.GetById(3).Children().ToArray();
|
||||
documents = snapshot.Content.GetById(3).Children(_variationAccesor).ToArray();
|
||||
AssertDocuments(documents, "N10");
|
||||
|
||||
documents = snapshot.Content.GetById(4).Children().ToArray();
|
||||
documents = snapshot.Content.GetById(4).Children(_variationAccesor).ToArray();
|
||||
AssertDocuments(documents, "N11", "N12");
|
||||
|
||||
documents = snapshot.Content.GetById(10).Children().ToArray();
|
||||
documents = snapshot.Content.GetById(10).Children(_variationAccesor).ToArray();
|
||||
AssertDocuments(documents);
|
||||
}
|
||||
|
||||
@@ -478,7 +480,7 @@ namespace Umbraco.Tests.PublishedContent
|
||||
var documents = snapshot.Content.GetAtRoot().ToArray();
|
||||
AssertDocuments(documents, "N1", "N2", "N3", "N10");
|
||||
|
||||
documents = snapshot.Content.GetById(3).Children().ToArray();
|
||||
documents = snapshot.Content.GetById(3).Children(_variationAccesor).ToArray();
|
||||
AssertDocuments(documents);
|
||||
|
||||
Assert.IsNull(snapshot.Content.GetById(10).Parent);
|
||||
@@ -520,7 +522,7 @@ namespace Umbraco.Tests.PublishedContent
|
||||
var documents = snapshot.Content.GetAtRoot().ToArray();
|
||||
AssertDocuments(documents, "N2", "N3");
|
||||
|
||||
documents = snapshot.Content.GetById(10).Children().ToArray();
|
||||
documents = snapshot.Content.GetById(10).Children(_variationAccesor).ToArray();
|
||||
AssertDocuments(documents, "N1");
|
||||
|
||||
Assert.AreEqual(10, snapshot.Content.GetById(1).Parent?.Id);
|
||||
@@ -597,7 +599,7 @@ namespace Umbraco.Tests.PublishedContent
|
||||
_snapshotService.Notify(new[] { new ContentCacheRefresher.JsonPayload(kit.Node.ParentContentId, Guid.Empty, TreeChangeTypes.RefreshBranch) }, out _, out _);
|
||||
|
||||
// changes that *I* make are immediately visible on the current snapshot
|
||||
var documents = snapshot.Content.GetById(kit.Node.ParentContentId).Children().ToArray();
|
||||
var documents = snapshot.Content.GetById(kit.Node.ParentContentId).Children(_variationAccesor).ToArray();
|
||||
AssertDocuments(documents, "N7", "N9", "N8");
|
||||
}
|
||||
|
||||
@@ -696,10 +698,10 @@ namespace Umbraco.Tests.PublishedContent
|
||||
}, out _, out _);
|
||||
|
||||
// changes that *I* make are immediately visible on the current snapshot
|
||||
var documents = snapshot.Content.GetById(1).Children().ToArray();
|
||||
var documents = snapshot.Content.GetById(1).Children(_variationAccesor).ToArray();
|
||||
AssertDocuments(documents, "N7", "N4", "N5", "N6");
|
||||
|
||||
documents = snapshot.Content.GetById(2).Children().ToArray();
|
||||
documents = snapshot.Content.GetById(2).Children(_variationAccesor).ToArray();
|
||||
AssertDocuments(documents, "N9", "N8");
|
||||
|
||||
Assert.AreEqual(1, snapshot.Content.GetById(7).Parent?.Id);
|
||||
@@ -721,15 +723,15 @@ namespace Umbraco.Tests.PublishedContent
|
||||
var documents = snapshot.Content.GetAtRoot().ToArray();
|
||||
AssertDocuments(documents, "N1-en-US");
|
||||
|
||||
documents = snapshot.Content.GetById(1).Children().ToArray();
|
||||
documents = snapshot.Content.GetById(1).Children(_variationAccesor).ToArray();
|
||||
AssertDocuments(documents, "N4", "N7-en-US");
|
||||
|
||||
//Get the invariant and list children, there's a variation context so it should return invariant AND en-us variants
|
||||
documents = snapshot.Content.GetById(4).Children().ToArray();
|
||||
documents = snapshot.Content.GetById(4).Children(_variationAccesor).ToArray();
|
||||
AssertDocuments(documents, "N10-en-US", "N11");
|
||||
|
||||
//Get the variant and list children, there's a variation context so it should return invariant AND en-us variants
|
||||
documents = snapshot.Content.GetById(7).Children().ToArray();
|
||||
documents = snapshot.Content.GetById(7).Children(_variationAccesor).ToArray();
|
||||
AssertDocuments(documents, "N12-en-US", "N13");
|
||||
|
||||
//TEST with fr-fr variation context
|
||||
@@ -739,15 +741,15 @@ namespace Umbraco.Tests.PublishedContent
|
||||
documents = snapshot.Content.GetAtRoot().ToArray();
|
||||
AssertDocuments(documents, "N1-fr-FR");
|
||||
|
||||
documents = snapshot.Content.GetById(1).Children().ToArray();
|
||||
documents = snapshot.Content.GetById(1).Children(_variationAccesor).ToArray();
|
||||
AssertDocuments(documents, "N4", "N7-fr-FR");
|
||||
|
||||
//Get the invariant and list children, there's a variation context so it should return invariant AND en-us variants
|
||||
documents = snapshot.Content.GetById(4).Children().ToArray();
|
||||
documents = snapshot.Content.GetById(4).Children(_variationAccesor).ToArray();
|
||||
AssertDocuments(documents, "N10-fr-FR", "N11");
|
||||
|
||||
//Get the variant and list children, there's a variation context so it should return invariant AND en-us variants
|
||||
documents = snapshot.Content.GetById(7).Children().ToArray();
|
||||
documents = snapshot.Content.GetById(7).Children(_variationAccesor).ToArray();
|
||||
AssertDocuments(documents, "N12-fr-FR", "N13");
|
||||
|
||||
//TEST specific cultures
|
||||
@@ -755,19 +757,19 @@ namespace Umbraco.Tests.PublishedContent
|
||||
documents = snapshot.Content.GetAtRoot("fr-FR").ToArray();
|
||||
AssertDocuments(documents, "N1-fr-FR");
|
||||
|
||||
documents = snapshot.Content.GetById(1).Children("fr-FR").ToArray();
|
||||
documents = snapshot.Content.GetById(1).Children(_variationAccesor, "fr-FR").ToArray();
|
||||
AssertDocuments(documents, "N4", "N7-fr-FR"); //NOTE: Returns invariant, this is expected
|
||||
documents = snapshot.Content.GetById(1).Children("").ToArray();
|
||||
documents = snapshot.Content.GetById(1).Children(_variationAccesor, "").ToArray();
|
||||
AssertDocuments(documents, "N4"); //Only returns invariant since that is what was requested
|
||||
|
||||
documents = snapshot.Content.GetById(4).Children("fr-FR").ToArray();
|
||||
documents = snapshot.Content.GetById(4).Children(_variationAccesor, "fr-FR").ToArray();
|
||||
AssertDocuments(documents, "N10-fr-FR", "N11"); //NOTE: Returns invariant, this is expected
|
||||
documents = snapshot.Content.GetById(4).Children("").ToArray();
|
||||
documents = snapshot.Content.GetById(4).Children(_variationAccesor, "").ToArray();
|
||||
AssertDocuments(documents, "N11"); //Only returns invariant since that is what was requested
|
||||
|
||||
documents = snapshot.Content.GetById(7).Children("fr-FR").ToArray();
|
||||
documents = snapshot.Content.GetById(7).Children(_variationAccesor, "fr-FR").ToArray();
|
||||
AssertDocuments(documents, "N12-fr-FR", "N13"); //NOTE: Returns invariant, this is expected
|
||||
documents = snapshot.Content.GetById(7).Children("").ToArray();
|
||||
documents = snapshot.Content.GetById(7).Children(_variationAccesor, "").ToArray();
|
||||
AssertDocuments(documents, "N13"); //Only returns invariant since that is what was requested
|
||||
|
||||
//TEST without variation context
|
||||
@@ -783,15 +785,15 @@ namespace Umbraco.Tests.PublishedContent
|
||||
documents = snapshot.Content.GetAtRoot("fr-FR").ToArray();
|
||||
Assert.AreEqual(1, documents.Length);
|
||||
|
||||
documents = snapshot.Content.GetById(1).Children().ToArray();
|
||||
documents = snapshot.Content.GetById(1).Children(_variationAccesor).ToArray();
|
||||
AssertDocuments(documents, "N4");
|
||||
|
||||
//Get the invariant and list children
|
||||
documents = snapshot.Content.GetById(4).Children().ToArray();
|
||||
documents = snapshot.Content.GetById(4).Children(_variationAccesor).ToArray();
|
||||
AssertDocuments(documents, "N11");
|
||||
|
||||
//Get the variant and list children
|
||||
documents = snapshot.Content.GetById(7).Children().ToArray();
|
||||
documents = snapshot.Content.GetById(7).Children(_variationAccesor).ToArray();
|
||||
AssertDocuments(documents, "N13");
|
||||
}
|
||||
|
||||
@@ -808,19 +810,19 @@ namespace Umbraco.Tests.PublishedContent
|
||||
var documents = snapshot.Content.GetAtRoot().ToArray();
|
||||
AssertDocuments(documents, "N1-en-US", "N2-en-US", "N3-en-US");
|
||||
|
||||
documents = snapshot.Content.GetById(1).Children().ToArray();
|
||||
documents = snapshot.Content.GetById(1).Children(_variationAccesor).ToArray();
|
||||
AssertDocuments(documents, "N4-en-US", "N5-en-US", "N6-en-US");
|
||||
|
||||
documents = snapshot.Content.GetById(2).Children().ToArray();
|
||||
documents = snapshot.Content.GetById(2).Children(_variationAccesor).ToArray();
|
||||
AssertDocuments(documents, "N9-en-US", "N8-en-US", "N7-en-US");
|
||||
|
||||
documents = snapshot.Content.GetById(3).Children().ToArray();
|
||||
documents = snapshot.Content.GetById(3).Children(_variationAccesor).ToArray();
|
||||
AssertDocuments(documents, "N10-en-US");
|
||||
|
||||
documents = snapshot.Content.GetById(4).Children().ToArray();
|
||||
documents = snapshot.Content.GetById(4).Children(_variationAccesor).ToArray();
|
||||
AssertDocuments(documents, "N11-en-US", "N12-en-US");
|
||||
|
||||
documents = snapshot.Content.GetById(10).Children().ToArray();
|
||||
documents = snapshot.Content.GetById(10).Children(_variationAccesor).ToArray();
|
||||
AssertDocuments(documents);
|
||||
|
||||
|
||||
@@ -829,26 +831,26 @@ namespace Umbraco.Tests.PublishedContent
|
||||
documents = snapshot.Content.GetAtRoot().ToArray();
|
||||
AssertDocuments(documents, "N1-fr-FR", "N3-fr-FR");
|
||||
|
||||
documents = snapshot.Content.GetById(1).Children().ToArray();
|
||||
documents = snapshot.Content.GetById(1).Children(_variationAccesor).ToArray();
|
||||
AssertDocuments(documents, "N4-fr-FR", "N6-fr-FR");
|
||||
|
||||
documents = snapshot.Content.GetById(2).Children().ToArray();
|
||||
documents = snapshot.Content.GetById(2).Children(_variationAccesor).ToArray();
|
||||
AssertDocuments(documents, "N9-fr-FR", "N7-fr-FR");
|
||||
|
||||
documents = snapshot.Content.GetById(3).Children().ToArray();
|
||||
documents = snapshot.Content.GetById(3).Children(_variationAccesor).ToArray();
|
||||
AssertDocuments(documents, "N10-fr-FR");
|
||||
|
||||
documents = snapshot.Content.GetById(4).Children().ToArray();
|
||||
documents = snapshot.Content.GetById(4).Children(_variationAccesor).ToArray();
|
||||
AssertDocuments(documents, "N12-fr-FR");
|
||||
|
||||
documents = snapshot.Content.GetById(10).Children().ToArray();
|
||||
documents = snapshot.Content.GetById(10).Children(_variationAccesor).ToArray();
|
||||
AssertDocuments(documents);
|
||||
|
||||
documents = snapshot.Content.GetById(1).Children("*").ToArray();
|
||||
documents = snapshot.Content.GetById(1).Children(_variationAccesor, "*").ToArray();
|
||||
AssertDocuments(documents, "N4-fr-FR", null, "N6-fr-FR");
|
||||
AssertDocuments("en-US", documents, "N4-en-US", "N5-en-US", "N6-en-US");
|
||||
|
||||
documents = snapshot.Content.GetById(1).Children("en-US").ToArray();
|
||||
documents = snapshot.Content.GetById(1).Children(_variationAccesor, "en-US").ToArray();
|
||||
AssertDocuments(documents, "N4-fr-FR", null, "N6-fr-FR");
|
||||
AssertDocuments("en-US", documents, "N4-en-US", "N5-en-US", "N6-en-US");
|
||||
|
||||
@@ -878,10 +880,10 @@ namespace Umbraco.Tests.PublishedContent
|
||||
var documents = snapshot.Content.GetAtRoot().ToArray();
|
||||
AssertDocuments(documents, "N1", "N2", "N3");
|
||||
|
||||
documents = snapshot.Content.GetById(1).Children().ToArray();
|
||||
documents = snapshot.Content.GetById(1).Children(_variationAccesor).ToArray();
|
||||
AssertDocuments(documents, "N4", "N5", "N6");
|
||||
|
||||
documents = snapshot.Content.GetById(2).Children().ToArray();
|
||||
documents = snapshot.Content.GetById(2).Children(_variationAccesor).ToArray();
|
||||
AssertDocuments(documents, "N9", "N8", "N7");
|
||||
|
||||
// notify
|
||||
@@ -895,10 +897,10 @@ namespace Umbraco.Tests.PublishedContent
|
||||
documents = snapshot.Content.GetAtRoot().ToArray();
|
||||
AssertDocuments(documents, "N1", "N2");
|
||||
|
||||
documents = snapshot.Content.GetById(1).Children().ToArray();
|
||||
documents = snapshot.Content.GetById(1).Children(_variationAccesor).ToArray();
|
||||
AssertDocuments(documents, "N4", "N6");
|
||||
|
||||
documents = snapshot.Content.GetById(2).Children().ToArray();
|
||||
documents = snapshot.Content.GetById(2).Children(_variationAccesor).ToArray();
|
||||
AssertDocuments(documents, "N8", "N7");
|
||||
|
||||
// notify
|
||||
@@ -912,7 +914,7 @@ namespace Umbraco.Tests.PublishedContent
|
||||
documents = snapshot.Content.GetAtRoot().ToArray();
|
||||
AssertDocuments(documents, "N2");
|
||||
|
||||
documents = snapshot.Content.GetById(2).Children().ToArray();
|
||||
documents = snapshot.Content.GetById(2).Children(_variationAccesor).ToArray();
|
||||
AssertDocuments(documents);
|
||||
}
|
||||
|
||||
@@ -927,10 +929,10 @@ namespace Umbraco.Tests.PublishedContent
|
||||
var documents = snapshot.Content.GetAtRoot().ToArray();
|
||||
AssertDocuments(documents, "N1", "N2", "N3");
|
||||
|
||||
documents = snapshot.Content.GetById(1).Children().ToArray();
|
||||
documents = snapshot.Content.GetById(1).Children(_variationAccesor).ToArray();
|
||||
AssertDocuments(documents, "N4", "N5", "N6");
|
||||
|
||||
documents = snapshot.Content.GetById(2).Children().ToArray();
|
||||
documents = snapshot.Content.GetById(2).Children(_variationAccesor).ToArray();
|
||||
AssertDocuments(documents, "N9", "N8", "N7");
|
||||
|
||||
// notify
|
||||
@@ -943,10 +945,10 @@ namespace Umbraco.Tests.PublishedContent
|
||||
documents = snapshot.Content.GetAtRoot().ToArray();
|
||||
AssertDocuments(documents, "N1", "N2", "N3");
|
||||
|
||||
documents = snapshot.Content.GetById(1).Children().ToArray();
|
||||
documents = snapshot.Content.GetById(1).Children(_variationAccesor).ToArray();
|
||||
AssertDocuments(documents, "N4", "N5", "N6");
|
||||
|
||||
documents = snapshot.Content.GetById(2).Children().ToArray();
|
||||
documents = snapshot.Content.GetById(2).Children(_variationAccesor).ToArray();
|
||||
AssertDocuments(documents, "N9", "N8", "N7");
|
||||
}
|
||||
|
||||
@@ -1319,7 +1321,7 @@ namespace Umbraco.Tests.PublishedContent
|
||||
{
|
||||
Assert.AreEqual(names.Length, documents.Length);
|
||||
for (var i = 0; i < names.Length; i++)
|
||||
Assert.AreEqual(names[i], documents[i].Name(culture));
|
||||
Assert.AreEqual(names[i], documents[i].Name(_variationAccesor, culture));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,6 +26,7 @@ using Umbraco.Web.Cache;
|
||||
using Umbraco.Web.PublishedCache;
|
||||
using Umbraco.Web.PublishedCache.NuCache;
|
||||
using Umbraco.Web.PublishedCache.NuCache.DataSource;
|
||||
using Current = Umbraco.Web.Composing.Current;
|
||||
|
||||
namespace Umbraco.Tests.PublishedContent
|
||||
{
|
||||
@@ -175,7 +176,7 @@ namespace Umbraco.Tests.PublishedContent
|
||||
|
||||
// create a published content type factory
|
||||
var contentTypeFactory = new PublishedContentTypeFactory(
|
||||
Mock.Of<IPublishedModelFactory>(),
|
||||
publishedModelFactory,
|
||||
new PropertyValueConverterCollection(Array.Empty<IPropertyValueConverter>()),
|
||||
dataTypeService);
|
||||
|
||||
@@ -203,7 +204,7 @@ namespace Umbraco.Tests.PublishedContent
|
||||
dataSource,
|
||||
globalSettings,
|
||||
Mock.Of<IEntityXmlSerializer>(),
|
||||
Mock.Of<IPublishedModelFactory>(),
|
||||
publishedModelFactory,
|
||||
new UrlSegmentProviderCollection(new[] { new DefaultUrlSegmentProvider(TestHelper.ShortStringHelper) }),
|
||||
typeFinder,
|
||||
TestHelper.GetHostingEnvironment(),
|
||||
@@ -232,30 +233,30 @@ namespace Umbraco.Tests.PublishedContent
|
||||
Assert.AreEqual("val-fr1", publishedContent.Value<string>("prop", "fr-FR"));
|
||||
Assert.AreEqual("val-uk1", publishedContent.Value<string>("prop", "en-UK"));
|
||||
|
||||
Assert.IsNull(publishedContent.Name()); // no invariant name for varying content
|
||||
Assert.AreEqual("name-fr1", publishedContent.Name("fr-FR"));
|
||||
Assert.AreEqual("name-uk1", publishedContent.Name("en-UK"));
|
||||
Assert.IsNull(publishedContent.Name(_variationAccesor)); // no invariant name for varying content
|
||||
Assert.AreEqual("name-fr1", publishedContent.Name(_variationAccesor, "fr-FR"));
|
||||
Assert.AreEqual("name-uk1", publishedContent.Name(_variationAccesor, "en-UK"));
|
||||
|
||||
var draftContent = snapshot.Content.GetById(true, 1);
|
||||
Assert.AreEqual("val2", draftContent.Value<string>("prop"));
|
||||
Assert.AreEqual("val-fr2", draftContent.Value<string>("prop", "fr-FR"));
|
||||
Assert.AreEqual("val-uk2", draftContent.Value<string>("prop", "en-UK"));
|
||||
|
||||
Assert.IsNull(draftContent.Name()); // no invariant name for varying content
|
||||
Assert.AreEqual("name-fr2", draftContent.Name("fr-FR"));
|
||||
Assert.AreEqual("name-uk2", draftContent.Name("en-UK"));
|
||||
Assert.IsNull(draftContent.Name(_variationAccesor)); // no invariant name for varying content
|
||||
Assert.AreEqual("name-fr2", draftContent.Name(_variationAccesor, "fr-FR"));
|
||||
Assert.AreEqual("name-uk2", draftContent.Name(_variationAccesor, "en-UK"));
|
||||
|
||||
// now french is default
|
||||
_variationAccesor.VariationContext = new VariationContext("fr-FR");
|
||||
Assert.AreEqual("val-fr1", publishedContent.Value<string>("prop"));
|
||||
Assert.AreEqual("name-fr1", publishedContent.Name());
|
||||
Assert.AreEqual(new DateTime(2018, 01, 01, 01, 00, 00), publishedContent.CultureDate());
|
||||
Assert.AreEqual("name-fr1", publishedContent.Name(_variationAccesor));
|
||||
Assert.AreEqual(new DateTime(2018, 01, 01, 01, 00, 00), publishedContent.CultureDate(_variationAccesor));
|
||||
|
||||
// now uk is default
|
||||
_variationAccesor.VariationContext = new VariationContext("en-UK");
|
||||
Assert.AreEqual("val-uk1", publishedContent.Value<string>("prop"));
|
||||
Assert.AreEqual("name-uk1", publishedContent.Name());
|
||||
Assert.AreEqual(new DateTime(2018, 01, 02, 01, 00, 00), publishedContent.CultureDate());
|
||||
Assert.AreEqual("name-uk1", publishedContent.Name(_variationAccesor));
|
||||
Assert.AreEqual(new DateTime(2018, 01, 02, 01, 00, 00), publishedContent.CultureDate(_variationAccesor));
|
||||
|
||||
// invariant needs to be retrieved explicitly, when it's not default
|
||||
Assert.AreEqual("val1", publishedContent.Value<string>("prop", culture: ""));
|
||||
@@ -275,7 +276,7 @@ namespace Umbraco.Tests.PublishedContent
|
||||
Assert.AreEqual(ContentVariation.Nothing, againContent.ContentType.GetPropertyType("prop").Variations);
|
||||
|
||||
// now, "no culture" means "invariant"
|
||||
Assert.AreEqual("It Works1!", againContent.Name());
|
||||
Assert.AreEqual("It Works1!", againContent.Name(_variationAccesor));
|
||||
Assert.AreEqual("val1", againContent.Value<string>("prop"));
|
||||
}
|
||||
|
||||
|
||||
@@ -4,8 +4,7 @@ using System.Collections.ObjectModel;
|
||||
using System.Linq;
|
||||
using Moq;
|
||||
using NUnit.Framework;
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Core.Composing;
|
||||
using Umbraco.Web.Composing;
|
||||
using Umbraco.Core.Logging;
|
||||
using Umbraco.Core.Models;
|
||||
using Umbraco.Core.Models.PublishedContent;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
using System.Collections.Generic;
|
||||
using NUnit.Framework;
|
||||
using Umbraco.Core.Composing;
|
||||
using Umbraco.Web.Composing;
|
||||
using Umbraco.Core.Models;
|
||||
using Umbraco.Core.Models.PublishedContent;
|
||||
using Umbraco.Tests.Testing;
|
||||
|
||||
@@ -102,7 +102,7 @@ namespace Umbraco.Tests.PublishedContent
|
||||
public void First()
|
||||
{
|
||||
var content = Current.UmbracoContext.Content.GetAtRoot().First();
|
||||
Assert.AreEqual("Content 1", content.Name());
|
||||
Assert.AreEqual("Content 1", content.Name(VariationContextAccessor));
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Web.Routing;
|
||||
using Moq;
|
||||
using Umbraco.Core;
|
||||
@@ -10,10 +9,8 @@ using Umbraco.Web;
|
||||
using Umbraco.Web.PublishedCache;
|
||||
using Umbraco.Web.Routing;
|
||||
using Umbraco.Web.Security;
|
||||
using Umbraco.Core.Composing;
|
||||
using Current = Umbraco.Core.Composing.Current;
|
||||
using Umbraco.Core.Cache;
|
||||
using Umbraco.Core.Configuration;
|
||||
using Umbraco.Core.Composing;
|
||||
using Umbraco.Core.Hosting;
|
||||
using Umbraco.Core.IO;
|
||||
using Umbraco.Core.Logging;
|
||||
@@ -23,6 +20,7 @@ using Umbraco.Core.Services;
|
||||
using Umbraco.Core.Strings;
|
||||
using Umbraco.Tests.TestHelpers;
|
||||
using Umbraco.Tests.Testing.Objects.Accessors;
|
||||
using Current = Umbraco.Web.Composing.Current;
|
||||
|
||||
namespace Umbraco.Tests.PublishedContent
|
||||
{
|
||||
|
||||
@@ -1,32 +1,28 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using NUnit.Framework;
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Core.Models.PublishedContent;
|
||||
using Umbraco.Core.PropertyEditors;
|
||||
using Umbraco.Web;
|
||||
using Umbraco.Web.PublishedCache;
|
||||
using Umbraco.Core.Composing;
|
||||
using Moq;
|
||||
using Newtonsoft.Json;
|
||||
using Umbraco.Core.Cache;
|
||||
using Umbraco.Core.Configuration;
|
||||
using Umbraco.Core.Composing;
|
||||
using Umbraco.Core.Hosting;
|
||||
using Umbraco.Core.IO;
|
||||
using Umbraco.Core.Logging;
|
||||
using Umbraco.Core.Models;
|
||||
using Umbraco.Core.Services;
|
||||
using Umbraco.Core.Services.Implement;
|
||||
using Umbraco.Core.Strings;
|
||||
using Umbraco.Tests.TestHelpers;
|
||||
using Umbraco.Tests.Testing;
|
||||
using Umbraco.Web.Models.PublishedContent;
|
||||
using Umbraco.Web.PropertyEditors;
|
||||
using Umbraco.Web.Templates;
|
||||
using Current = Umbraco.Web.Composing.Current;
|
||||
|
||||
namespace Umbraco.Tests.PublishedContent
|
||||
{
|
||||
@@ -184,7 +180,7 @@ namespace Umbraco.Tests.PublishedContent
|
||||
{
|
||||
var doc = GetNode(1173);
|
||||
|
||||
var items = doc.Children().Where(x => x.IsVisible()).ToIndexedArray();
|
||||
var items = doc.Children(VariationContextAccessor).Where(x => x.IsVisible()).ToIndexedArray();
|
||||
|
||||
foreach (var item in items)
|
||||
{
|
||||
@@ -205,7 +201,7 @@ namespace Umbraco.Tests.PublishedContent
|
||||
var doc = GetNode(1173);
|
||||
|
||||
var items = doc
|
||||
.Children()
|
||||
.Children(VariationContextAccessor)
|
||||
.Where(x => x.IsVisible())
|
||||
.ToIndexedArray();
|
||||
|
||||
@@ -260,7 +256,7 @@ namespace Umbraco.Tests.PublishedContent
|
||||
var doc = GetNode(1173);
|
||||
var ct = doc.ContentType;
|
||||
|
||||
var items = doc.Children()
|
||||
var items = doc.Children(VariationContextAccessor)
|
||||
.Select(x => x.CreateModel(Current.PublishedModelFactory)) // linq, returns IEnumerable<IPublishedContent>
|
||||
|
||||
// only way around this is to make sure every IEnumerable<T> extension
|
||||
@@ -292,7 +288,7 @@ namespace Umbraco.Tests.PublishedContent
|
||||
{
|
||||
var doc = GetNode(1173);
|
||||
|
||||
var items = doc.Children().Take(4).ToIndexedArray();
|
||||
var items = doc.Children(VariationContextAccessor).Take(4).ToIndexedArray();
|
||||
|
||||
foreach (var item in items)
|
||||
{
|
||||
@@ -312,7 +308,7 @@ namespace Umbraco.Tests.PublishedContent
|
||||
{
|
||||
var doc = GetNode(1173);
|
||||
|
||||
foreach (var d in doc.Children().Skip(1).ToIndexedArray())
|
||||
foreach (var d in doc.Children(VariationContextAccessor).Skip(1).ToIndexedArray())
|
||||
{
|
||||
if (d.Content.Id != 1176)
|
||||
{
|
||||
@@ -330,7 +326,7 @@ namespace Umbraco.Tests.PublishedContent
|
||||
{
|
||||
var doc = GetNode(1173);
|
||||
|
||||
var items = doc.Children()
|
||||
var items = doc.Children(VariationContextAccessor)
|
||||
.Concat(new[] { GetNode(1175), GetNode(4444) })
|
||||
.ToIndexedArray();
|
||||
|
||||
@@ -415,7 +411,7 @@ namespace Umbraco.Tests.PublishedContent
|
||||
|
||||
var doc = GetNode(1046);
|
||||
|
||||
var found1 = doc.Children().GroupBy(x => x.ContentType.Alias).ToArray();
|
||||
var found1 = doc.Children(VariationContextAccessor).GroupBy(x => x.ContentType.Alias).ToArray();
|
||||
|
||||
Assert.AreEqual(2, found1.Length);
|
||||
Assert.AreEqual(2, found1.Single(x => x.Key.ToString() == "Home").Count());
|
||||
@@ -436,8 +432,8 @@ namespace Umbraco.Tests.PublishedContent
|
||||
|
||||
var doc = GetNode(1046);
|
||||
|
||||
var found1 = doc.Children().Where(x => x.ContentType.Alias == "CustomDocument");
|
||||
var found2 = doc.Children().Where(x => x.ContentType.Alias == "Home");
|
||||
var found1 = doc.Children(VariationContextAccessor).Where(x => x.ContentType.Alias == "CustomDocument");
|
||||
var found2 = doc.Children(VariationContextAccessor).Where(x => x.ContentType.Alias == "Home");
|
||||
|
||||
Assert.AreEqual(1, found1.Count());
|
||||
Assert.AreEqual(2, found2.Count());
|
||||
@@ -448,7 +444,7 @@ namespace Umbraco.Tests.PublishedContent
|
||||
{
|
||||
var doc = GetNode(1173);
|
||||
|
||||
var ordered = doc.Children().OrderBy(x => x.UpdateDate);
|
||||
var ordered = doc.Children(VariationContextAccessor).OrderBy(x => x.UpdateDate);
|
||||
|
||||
var correctOrder = new[] { 1178, 1177, 1174, 1176 };
|
||||
for (var i = 0; i < correctOrder.Length; i++)
|
||||
|
||||
@@ -72,7 +72,7 @@ namespace Umbraco.Tests.PublishedContent
|
||||
{
|
||||
var cache = new PublishedMediaCache(new XmlStore((XmlDocument)null, null, null, null, HostingEnvironment),
|
||||
ServiceContext.MediaService, ServiceContext.UserService, new DictionaryAppCache(), ContentTypesCache,
|
||||
Factory.GetInstance<IEntityXmlSerializer>(), Factory.GetInstance<IUmbracoContextAccessor>());
|
||||
Factory.GetInstance<IEntityXmlSerializer>(), Factory.GetInstance<IUmbracoContextAccessor>(), VariationContextAccessor);
|
||||
var doc = cache.GetById(id);
|
||||
Assert.IsNotNull(doc);
|
||||
return doc;
|
||||
@@ -133,7 +133,7 @@ namespace Umbraco.Tests.PublishedContent
|
||||
|
||||
//we are using the media.xml media to test the examine results implementation, see the media.xml file in the ExamineHelpers namespace
|
||||
var publishedMedia = cache.GetById(1111);
|
||||
var rootChildren = publishedMedia.Children().ToArray();
|
||||
var rootChildren = publishedMedia.Children(VariationContextAccessor).ToArray();
|
||||
var currSort = 0;
|
||||
for (var i = 0; i < rootChildren.Count(); i++)
|
||||
{
|
||||
@@ -210,11 +210,11 @@ namespace Umbraco.Tests.PublishedContent
|
||||
|
||||
//we are using the media.xml media to test the examine results implementation, see the media.xml file in the ExamineHelpers namespace
|
||||
var publishedMedia = cache.GetById(1111);
|
||||
var rootChildren = publishedMedia.Children();
|
||||
var rootChildren = publishedMedia.Children(VariationContextAccessor);
|
||||
Assert.IsTrue(rootChildren.Select(x => x.Id).ContainsAll(new[] { 2222, 1113, 1114, 1115, 1116 }));
|
||||
|
||||
var publishedChild1 = cache.GetById(2222);
|
||||
var subChildren = publishedChild1.Children();
|
||||
var subChildren = publishedChild1.Children(VariationContextAccessor);
|
||||
Assert.IsTrue(subChildren.Select(x => x.Id).ContainsAll(new[] { 2112 }));
|
||||
}
|
||||
}
|
||||
@@ -342,11 +342,11 @@ namespace Umbraco.Tests.PublishedContent
|
||||
var mSubChild3 = MakeNewMedia("SubChild3", mType, user, mChild1.Id);
|
||||
|
||||
var publishedMedia = GetNode(mRoot.Id);
|
||||
var rootChildren = publishedMedia.Children();
|
||||
var rootChildren = publishedMedia.Children(VariationContextAccessor);
|
||||
Assert.IsTrue(rootChildren.Select(x => x.Id).ContainsAll(new[] { mChild1.Id, mChild2.Id, mChild3.Id }));
|
||||
|
||||
var publishedChild1 = GetNode(mChild1.Id);
|
||||
var subChildren = publishedChild1.Children();
|
||||
var subChildren = publishedChild1.Children(VariationContextAccessor);
|
||||
Assert.IsTrue(subChildren.Select(x => x.Id).ContainsAll(new[] { mSubChild1.Id, mSubChild2.Id, mSubChild3.Id }));
|
||||
}
|
||||
|
||||
@@ -485,7 +485,7 @@ namespace Umbraco.Tests.PublishedContent
|
||||
</Image>");
|
||||
var node = xml.DescendantsAndSelf("Image").Single(x => (int)x.Attribute("id") == nodeId);
|
||||
|
||||
var publishedMedia = new PublishedMediaCache(new XmlStore((XmlDocument)null, null, null, null, HostingEnvironment), ServiceContext.MediaService, ServiceContext.UserService, new DictionaryAppCache(), ContentTypesCache, Factory.GetInstance<IEntityXmlSerializer>(), Factory.GetInstance<IUmbracoContextAccessor>());
|
||||
var publishedMedia = new PublishedMediaCache(new XmlStore((XmlDocument)null, null, null, null, HostingEnvironment), ServiceContext.MediaService, ServiceContext.UserService, new DictionaryAppCache(), ContentTypesCache, Factory.GetInstance<IEntityXmlSerializer>(), Factory.GetInstance<IUmbracoContextAccessor>(), VariationContextAccessor);
|
||||
|
||||
var nav = node.CreateNavigator();
|
||||
|
||||
@@ -505,7 +505,7 @@ namespace Umbraco.Tests.PublishedContent
|
||||
var errorXml = new XElement("error", string.Format("No media is maching '{0}'", 1234));
|
||||
var nav = errorXml.CreateNavigator();
|
||||
|
||||
var publishedMedia = new PublishedMediaCache(new XmlStore((XmlDocument)null, null, null, null, HostingEnvironment), ServiceContext.MediaService, ServiceContext.UserService, new DictionaryAppCache(), ContentTypesCache, Factory.GetInstance<IEntityXmlSerializer>(), Factory.GetInstance<IUmbracoContextAccessor>());
|
||||
var publishedMedia = new PublishedMediaCache(new XmlStore((XmlDocument)null, null, null, null, HostingEnvironment), ServiceContext.MediaService, ServiceContext.UserService, new DictionaryAppCache(), ContentTypesCache, Factory.GetInstance<IEntityXmlSerializer>(), Factory.GetInstance<IUmbracoContextAccessor>(), VariationContextAccessor);
|
||||
var converted = publishedMedia.ConvertFromXPathNodeIterator(nav.Select("/"), 1234);
|
||||
|
||||
Assert.IsNull(converted);
|
||||
|
||||
@@ -5,7 +5,7 @@ using System.Linq;
|
||||
using Moq;
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Core.Cache;
|
||||
using Umbraco.Core.Composing;
|
||||
using Umbraco.Web.Composing;
|
||||
using Umbraco.Core.Logging;
|
||||
using Umbraco.Core.Models;
|
||||
using Umbraco.Core.Models.PublishedContent;
|
||||
|
||||
@@ -3,9 +3,8 @@ using System.Globalization;
|
||||
using Moq;
|
||||
using NUnit.Framework;
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Core.Composing;
|
||||
using Umbraco.Web.Composing;
|
||||
using Umbraco.Core.Configuration;
|
||||
using Umbraco.Core.Models;
|
||||
using Umbraco.Tests.TestHelpers;
|
||||
using Umbraco.Tests.Testing;
|
||||
using Umbraco.Web.Routing;
|
||||
|
||||
@@ -4,8 +4,7 @@ using System.Linq;
|
||||
using Moq;
|
||||
using NUnit.Framework;
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Core.Composing;
|
||||
using Umbraco.Core.Configuration;
|
||||
using Umbraco.Web.Composing;
|
||||
using Umbraco.Core.Models;
|
||||
using Umbraco.Core.Services;
|
||||
using Umbraco.Tests.TestHelpers.Entities;
|
||||
@@ -54,6 +53,7 @@ namespace Umbraco.Tests.Routing
|
||||
var urls = content.GetContentUrls(publishedRouter,
|
||||
umbContext,
|
||||
GetLangService("en-US", "fr-FR"), GetTextService(), ServiceContext.ContentService,
|
||||
VariationContextAccessor,
|
||||
Logger).ToList();
|
||||
|
||||
Assert.AreEqual(1, urls.Count);
|
||||
@@ -79,7 +79,7 @@ namespace Umbraco.Tests.Routing
|
||||
var urls = content.GetContentUrls(publishedRouter,
|
||||
umbContext,
|
||||
GetLangService("en-US", "fr-FR"), GetTextService(), ServiceContext.ContentService,
|
||||
Logger).ToList();
|
||||
VariationContextAccessor, Logger).ToList();
|
||||
|
||||
Assert.AreEqual(1, urls.Count);
|
||||
Assert.AreEqual("/home/", urls[0].Text);
|
||||
@@ -111,7 +111,7 @@ namespace Umbraco.Tests.Routing
|
||||
var urls = child.GetContentUrls(publishedRouter,
|
||||
umbContext,
|
||||
GetLangService("en-US", "fr-FR"), GetTextService(), ServiceContext.ContentService,
|
||||
Logger).ToList();
|
||||
VariationContextAccessor, Logger).ToList();
|
||||
|
||||
Assert.AreEqual(1, urls.Count);
|
||||
Assert.AreEqual("/home/sub1/", urls[0].Text);
|
||||
|
||||
@@ -37,7 +37,7 @@ namespace Umbraco.Tests.Routing
|
||||
|
||||
var propertyEditors = new PropertyEditorCollection(new DataEditorCollection(new IDataEditor[]
|
||||
{
|
||||
new FileUploadPropertyEditor(logger, mediaFileSystemMock, contentSection, dataTypeService, LocalizationService, ShortStringHelper),
|
||||
new FileUploadPropertyEditor(logger, mediaFileSystemMock, contentSection, dataTypeService, LocalizationService, LocalizedTextService, ShortStringHelper),
|
||||
new ImageCropperPropertyEditor(logger, mediaFileSystemMock, contentSection, dataTypeService, LocalizationService, IOHelper, ShortStringHelper, LocalizedTextService),
|
||||
}));
|
||||
_mediaUrlProvider = new DefaultMediaUrlProvider(propertyEditors);
|
||||
|
||||
@@ -50,7 +50,8 @@ namespace Umbraco.Tests.Routing
|
||||
TestObjects.GetGlobalSettings(),
|
||||
ShortStringHelper,
|
||||
new SurfaceControllerTypeCollection(Enumerable.Empty<Type>()),
|
||||
new UmbracoApiControllerTypeCollection(Enumerable.Empty<Type>()));
|
||||
new UmbracoApiControllerTypeCollection(Enumerable.Empty<Type>()),
|
||||
IOHelper);
|
||||
}
|
||||
|
||||
public class TestRuntime : WebRuntime
|
||||
|
||||
@@ -5,7 +5,7 @@ using System.Linq;
|
||||
using Moq;
|
||||
using NUnit.Framework;
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Core.Composing;
|
||||
using Umbraco.Web.Composing;
|
||||
using Umbraco.Core.Configuration;
|
||||
using Umbraco.Core.Models;
|
||||
using Umbraco.Core.Models.PublishedContent;
|
||||
|
||||
@@ -4,10 +4,8 @@ using System.Data;
|
||||
using System.Web.Hosting;
|
||||
using Examine;
|
||||
using Moq;
|
||||
using NPoco.Expressions;
|
||||
using NUnit.Framework;
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Core.Compose;
|
||||
using Umbraco.Core.Composing;
|
||||
using Umbraco.Core.Configuration;
|
||||
using Umbraco.Core.Configuration.UmbracoSettings;
|
||||
@@ -24,6 +22,7 @@ using Umbraco.Tests.TestHelpers.Stubs;
|
||||
using Umbraco.Web;
|
||||
using Umbraco.Web.Hosting;
|
||||
using Umbraco.Web.Runtime;
|
||||
using Current = Umbraco.Web.Composing.Current;
|
||||
|
||||
namespace Umbraco.Tests.Runtimes
|
||||
{
|
||||
|
||||
@@ -35,6 +35,7 @@ using Umbraco.Web.PublishedCache;
|
||||
using Umbraco.Web.Routing;
|
||||
using Umbraco.Web.Runtime;
|
||||
using File = System.IO.File;
|
||||
using Current = Umbraco.Web.Composing.Current;
|
||||
|
||||
namespace Umbraco.Tests.Runtimes
|
||||
{
|
||||
@@ -48,7 +49,7 @@ namespace Umbraco.Tests.Runtimes
|
||||
IFactory factory = null;
|
||||
|
||||
// clear
|
||||
foreach (var file in Directory.GetFiles(Path.Combine(Current.IOHelper.MapPath("~/App_Data")), "NuCache.*"))
|
||||
foreach (var file in Directory.GetFiles(Path.Combine(TestHelper.IOHelper.MapPath("~/App_Data")), "NuCache.*"))
|
||||
File.Delete(file);
|
||||
|
||||
// settings
|
||||
@@ -71,6 +72,7 @@ namespace Umbraco.Tests.Runtimes
|
||||
var backOfficeInfo = TestHelper.GetBackOfficeInfo();
|
||||
var runtimeState = new RuntimeState(logger, null, null, new Lazy<IMainDom>(() => mainDom), new Lazy<IServerRegistrar>(() => factory.GetInstance<IServerRegistrar>()), umbracoVersion, hostingEnvironment, backOfficeInfo);
|
||||
var configs = TestHelper.GetConfigs();
|
||||
var variationContextAccessor = TestHelper.VariationContextAccessor;
|
||||
|
||||
// create the register and the composition
|
||||
var register = TestHelper.GetRegister();
|
||||
@@ -103,7 +105,7 @@ namespace Umbraco.Tests.Runtimes
|
||||
composition.Register<IVariationContextAccessor, TestVariationContextAccessor>(Lifetime.Singleton);
|
||||
composition.Register<IDefaultCultureAccessor, TestDefaultCultureAccessor>(Lifetime.Singleton);
|
||||
composition.Register<ISiteDomainHelper>(_ => Mock.Of<ISiteDomainHelper>(), Lifetime.Singleton);
|
||||
composition.RegisterUnique(f => new DistributedCache());
|
||||
composition.RegisterUnique(f => new DistributedCache(f.GetInstance<IServerMessenger>(), f.GetInstance<CacheRefresherCollection>()));
|
||||
composition.WithCollectionBuilder<UrlProviderCollectionBuilder>().Append<DefaultUrlProvider>();
|
||||
composition.RegisterUnique<IDistributedCacheBinder, DistributedCacheBinder>();
|
||||
composition.RegisterUnique<IExamineManager>(f => ExamineManager.Instance);
|
||||
@@ -203,7 +205,7 @@ namespace Umbraco.Tests.Runtimes
|
||||
// but a draft document
|
||||
pcontent = umbracoContext.Content.GetById(true, content.Id);
|
||||
Assert.IsNotNull(pcontent);
|
||||
Assert.AreEqual("test", pcontent.Name());
|
||||
Assert.AreEqual("test", pcontent.Name(variationContextAccessor));
|
||||
Assert.IsTrue(pcontent.IsDraft());
|
||||
|
||||
// no published url
|
||||
@@ -217,7 +219,7 @@ namespace Umbraco.Tests.Runtimes
|
||||
// assert that snapshot has been updated and there is now a published document
|
||||
pcontent = umbracoContext.Content.GetById(content.Id);
|
||||
Assert.IsNotNull(pcontent);
|
||||
Assert.AreEqual("test", pcontent.Name());
|
||||
Assert.AreEqual("test", pcontent.Name(variationContextAccessor));
|
||||
Assert.IsFalse(pcontent.IsDraft());
|
||||
|
||||
// but the url is the published one - no draft url
|
||||
@@ -226,7 +228,7 @@ namespace Umbraco.Tests.Runtimes
|
||||
// and also an updated draft document
|
||||
pcontent = umbracoContext.Content.GetById(true, content.Id);
|
||||
Assert.IsNotNull(pcontent);
|
||||
Assert.AreEqual("testx", pcontent.Name());
|
||||
Assert.AreEqual("testx", pcontent.Name(variationContextAccessor));
|
||||
Assert.IsTrue(pcontent.IsDraft());
|
||||
|
||||
// and the published document has a url
|
||||
|
||||
@@ -4,6 +4,7 @@ using Moq;
|
||||
using NUnit.Framework;
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Core.Cache;
|
||||
using Umbraco.Core.Composing;
|
||||
using Umbraco.Core.Events;
|
||||
using Umbraco.Core.Models;
|
||||
using Umbraco.Core.IO;
|
||||
@@ -11,10 +12,10 @@ using Umbraco.Core.Logging;
|
||||
using Umbraco.Core.Scoping;
|
||||
using Umbraco.Tests.TestHelpers;
|
||||
using Umbraco.Tests.TestHelpers.Entities;
|
||||
using Umbraco.Core.Composing;
|
||||
using Umbraco.Core.Persistence.Mappers;
|
||||
using Umbraco.Core.Services;
|
||||
using Umbraco.Tests.Components;
|
||||
using Current = Umbraco.Web.Composing.Current;
|
||||
|
||||
namespace Umbraco.Tests.Scoping
|
||||
{
|
||||
|
||||
@@ -4,7 +4,7 @@ using System.Text;
|
||||
using Moq;
|
||||
using NUnit.Framework;
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Core.Composing;
|
||||
using Umbraco.Web.Composing;
|
||||
using Umbraco.Core.IO;
|
||||
using Umbraco.Tests.TestHelpers;
|
||||
using Umbraco.Tests.Testing;
|
||||
|
||||
@@ -29,6 +29,7 @@ using Umbraco.Web.PublishedCache.NuCache;
|
||||
using Umbraco.Web.PublishedCache.NuCache.DataSource;
|
||||
using Umbraco.Web.Routing;
|
||||
using Umbraco.Web.Security;
|
||||
using Current = Umbraco.Web.Composing.Current;
|
||||
|
||||
namespace Umbraco.Tests.Scoping
|
||||
{
|
||||
@@ -101,7 +102,7 @@ namespace Umbraco.Tests.Scoping
|
||||
new DatabaseDataSource(),
|
||||
Factory.GetInstance<IGlobalSettings>(),
|
||||
Factory.GetInstance<IEntityXmlSerializer>(),
|
||||
Mock.Of<IPublishedModelFactory>(),
|
||||
new NoopPublishedModelFactory(),
|
||||
new UrlSegmentProviderCollection(new[] { new DefaultUrlSegmentProvider(ShortStringHelper) }),
|
||||
typeFinder,
|
||||
hostingEnvironment,
|
||||
@@ -140,7 +141,7 @@ namespace Umbraco.Tests.Scoping
|
||||
var umbracoContext = GetUmbracoContextNu("http://example.com/", setSingleton: true);
|
||||
|
||||
// wire cache refresher
|
||||
_distributedCacheBinder = new DistributedCacheBinder(new DistributedCache(), Mock.Of<IUmbracoContextFactory>(), Mock.Of<ILogger>());
|
||||
_distributedCacheBinder = new DistributedCacheBinder(new DistributedCache(Current.ServerMessenger, Current.CacheRefreshers), Mock.Of<IUmbracoContextFactory>(), Mock.Of<ILogger>());
|
||||
_distributedCacheBinder.BindEvents(true);
|
||||
|
||||
// create document type, document
|
||||
@@ -158,7 +159,7 @@ namespace Umbraco.Tests.Scoping
|
||||
|
||||
// during events, due to LiveSnapshot, we see the changes
|
||||
Assert.IsNotNull(e);
|
||||
Assert.AreEqual("changed", e.Name());
|
||||
Assert.AreEqual("changed", e.Name(VariationContextAccessor));
|
||||
};
|
||||
|
||||
using (var scope = ScopeProvider.CreateScope())
|
||||
@@ -170,7 +171,7 @@ namespace Umbraco.Tests.Scoping
|
||||
// been created
|
||||
var x = umbracoContext.Content.GetById(item.Id);
|
||||
Assert.IsNotNull(x);
|
||||
Assert.AreEqual("name", x.Name());
|
||||
Assert.AreEqual("name", x.Name(VariationContextAccessor));
|
||||
|
||||
ContentService.Published += OnPublishedAssert;
|
||||
|
||||
@@ -192,7 +193,7 @@ namespace Umbraco.Tests.Scoping
|
||||
// else changes have been rolled back
|
||||
x = umbracoContext.Content.GetById(item.Id);
|
||||
Assert.IsNotNull(x);
|
||||
Assert.AreEqual(complete ? "changed" : "name", x.Name());
|
||||
Assert.AreEqual(complete ? "changed" : "name", x.Name(VariationContextAccessor));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using NUnit.Framework;
|
||||
using Umbraco.Core.Cache;
|
||||
using Umbraco.Core.Composing;
|
||||
using Umbraco.Web.Composing;
|
||||
using Umbraco.Core.Models;
|
||||
using Umbraco.Core.Models.Membership;
|
||||
using Umbraco.Core.Scoping;
|
||||
@@ -75,7 +75,7 @@ namespace Umbraco.Tests.Scoping
|
||||
// get user again - else we'd modify the one that's in the cache
|
||||
user = service.GetUserById(user.Id);
|
||||
|
||||
_distributedCacheBinder = new DistributedCacheBinder(new DistributedCache(), Mock.Of<IUmbracoContextFactory>(), Mock.Of<ILogger>());
|
||||
_distributedCacheBinder = new DistributedCacheBinder(new DistributedCache(Current.ServerMessenger, Current.CacheRefreshers), Mock.Of<IUmbracoContextFactory>(), Mock.Of<ILogger>());
|
||||
_distributedCacheBinder.BindEvents(true);
|
||||
|
||||
Assert.IsNull(scopeProvider.AmbientScope);
|
||||
@@ -156,7 +156,7 @@ namespace Umbraco.Tests.Scoping
|
||||
Assert.AreEqual(lang.Id, globalCached.Id);
|
||||
Assert.AreEqual("fr-FR", globalCached.IsoCode);
|
||||
|
||||
_distributedCacheBinder = new DistributedCacheBinder(new DistributedCache(), Mock.Of<IUmbracoContextFactory>(), Mock.Of<ILogger>());
|
||||
_distributedCacheBinder = new DistributedCacheBinder(new DistributedCache(Current.ServerMessenger, Current.CacheRefreshers), Mock.Of<IUmbracoContextFactory>(), Mock.Of<ILogger>());
|
||||
_distributedCacheBinder.BindEvents(true);
|
||||
|
||||
Assert.IsNull(scopeProvider.AmbientScope);
|
||||
@@ -248,7 +248,7 @@ namespace Umbraco.Tests.Scoping
|
||||
Assert.AreEqual(item.Id, globalCached.Id);
|
||||
Assert.AreEqual("item-key", globalCached.ItemKey);
|
||||
|
||||
_distributedCacheBinder = new DistributedCacheBinder(new DistributedCache(), Mock.Of<IUmbracoContextFactory>(), Mock.Of<ILogger>());
|
||||
_distributedCacheBinder = new DistributedCacheBinder(new DistributedCache(Current.ServerMessenger, Current.CacheRefreshers), Mock.Of<IUmbracoContextFactory>(), Mock.Of<ILogger>());
|
||||
_distributedCacheBinder.BindEvents(true);
|
||||
|
||||
Assert.IsNull(scopeProvider.AmbientScope);
|
||||
|
||||
@@ -5,7 +5,7 @@ using Moq;
|
||||
using NUnit.Framework;
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Core.Cache;
|
||||
using Umbraco.Core.Composing;
|
||||
using Umbraco.Web.Composing;
|
||||
using Umbraco.Core.Configuration.UmbracoSettings;
|
||||
using Umbraco.Core.Events;
|
||||
using Umbraco.Core.Logging;
|
||||
@@ -93,7 +93,7 @@ namespace Umbraco.Tests.Scoping
|
||||
var item = new Content("name", -1, contentType);
|
||||
|
||||
// wire cache refresher
|
||||
_distributedCacheBinder = new DistributedCacheBinder(new DistributedCache(), Mock.Of<IUmbracoContextFactory>(), Mock.Of<ILogger>());
|
||||
_distributedCacheBinder = new DistributedCacheBinder(new DistributedCache(Current.ServerMessenger, Current.CacheRefreshers), Mock.Of<IUmbracoContextFactory>(), Mock.Of<ILogger>());
|
||||
_distributedCacheBinder.BindEvents(true);
|
||||
|
||||
// check xml in context = "before"
|
||||
@@ -206,7 +206,7 @@ namespace Umbraco.Tests.Scoping
|
||||
Current.Services.ContentTypeService.Save(contentType);
|
||||
|
||||
// wire cache refresher
|
||||
_distributedCacheBinder = new DistributedCacheBinder(new DistributedCache(), Mock.Of<IUmbracoContextFactory>(), Mock.Of<ILogger>());
|
||||
_distributedCacheBinder = new DistributedCacheBinder(new DistributedCache(Current.ServerMessenger, Current.CacheRefreshers), Mock.Of<IUmbracoContextFactory>(), Mock.Of<ILogger>());
|
||||
_distributedCacheBinder.BindEvents(true);
|
||||
|
||||
// check xml in context = "before"
|
||||
|
||||
@@ -7,8 +7,7 @@ using Microsoft.Owin;
|
||||
using Moq;
|
||||
using NUnit.Framework;
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Core.Composing;
|
||||
using Umbraco.Core.Services;
|
||||
using Umbraco.Web.Composing;
|
||||
using Umbraco.Tests.TestHelpers;
|
||||
using Umbraco.Tests.Testing;
|
||||
using Umbraco.Tests.Testing.Objects.Accessors;
|
||||
|
||||
@@ -2,12 +2,9 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Web.Security;
|
||||
using Moq;
|
||||
using NUnit.Framework;
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Core.Composing;
|
||||
using Umbraco.Core.Events;
|
||||
using Umbraco.Web.Composing;
|
||||
using Umbraco.Core.Models;
|
||||
using Umbraco.Core.Models.Entities;
|
||||
using Umbraco.Core.Models.Membership;
|
||||
|
||||
@@ -6,7 +6,7 @@ using System.Threading;
|
||||
using NPoco;
|
||||
using NUnit.Framework;
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Core.Composing;
|
||||
using Umbraco.Web.Composing;
|
||||
using Umbraco.Core.Logging;
|
||||
using Umbraco.Core.Models;
|
||||
using Umbraco.Core.Persistence;
|
||||
|
||||
@@ -5,9 +5,8 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using NUnit.Framework;
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Core.Composing;
|
||||
using Umbraco.Web.Composing;
|
||||
using Umbraco.Core.Strings;
|
||||
using Umbraco.Tests.TestHelpers;
|
||||
using Umbraco.Tests.Testing;
|
||||
using Umbraco.Web;
|
||||
|
||||
|
||||
@@ -5,14 +5,13 @@ using NPoco;
|
||||
using NUnit.Framework;
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Core.Cache;
|
||||
using Umbraco.Core.Composing;
|
||||
using Umbraco.Core.Logging;
|
||||
using Umbraco.Core.Persistence.Mappers;
|
||||
using Umbraco.Core.Persistence.SqlSyntax;
|
||||
using Umbraco.Core.Composing;
|
||||
using Umbraco.Core.Configuration;
|
||||
using Umbraco.Core.IO;
|
||||
using Umbraco.Core.Persistence;
|
||||
using Umbraco.Tests.Components;
|
||||
using Current = Umbraco.Web.Composing.Current;
|
||||
|
||||
namespace Umbraco.Tests.TestHelpers
|
||||
{
|
||||
|
||||
@@ -7,9 +7,10 @@ using System.Web.Routing;
|
||||
using System.Web.SessionState;
|
||||
using Moq;
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Core.Logging;
|
||||
using Umbraco.Core.Composing;
|
||||
using Umbraco.Core.Logging;
|
||||
using Umbraco.Web;
|
||||
using Current = Umbraco.Web.Composing.Current;
|
||||
|
||||
namespace Umbraco.Tests.TestHelpers.Stubs
|
||||
{
|
||||
|
||||
@@ -19,12 +19,14 @@ using Umbraco.Core.IO;
|
||||
using Umbraco.Core.Logging;
|
||||
using Umbraco.Core.Models;
|
||||
using Umbraco.Core.Models.Entities;
|
||||
using Umbraco.Core.Models.PublishedContent;
|
||||
using Umbraco.Core.Persistence;
|
||||
using Umbraco.Core.PropertyEditors;
|
||||
using Umbraco.Core.Services;
|
||||
using Umbraco.Core.Strings;
|
||||
using Umbraco.Core.Sync;
|
||||
using Umbraco.Net;
|
||||
using Umbraco.Tests.Testing.Objects.Accessors;
|
||||
using Umbraco.Web;
|
||||
using Umbraco.Web.Hosting;
|
||||
using File = System.IO.File;
|
||||
@@ -86,11 +88,13 @@ namespace Umbraco.Tests.TestHelpers
|
||||
}
|
||||
|
||||
public static IShortStringHelper ShortStringHelper { get; } = new DefaultShortStringHelper(new DefaultShortStringHelperConfig());
|
||||
public static IVariationContextAccessor VariationContextAccessor { get; } = new TestVariationContextAccessor();
|
||||
public static IDbProviderFactoryCreator DbProviderFactoryCreator { get; } = new UmbracoDbProviderFactoryCreator(Constants.DbProviderNames.SqlCe);
|
||||
public static IBulkSqlInsertProvider BulkSqlInsertProvider { get; } = new SqlCeBulkSqlInsertProvider();
|
||||
public static IMarchal Marchal { get; } = new FrameworkMarchal();
|
||||
public static ICoreDebug CoreDebug { get; } = new CoreDebug();
|
||||
|
||||
|
||||
public static IIOHelper IOHelper { get; } = new IOHelper(GetHostingEnvironment());
|
||||
public static IMainDom MainDom { get; } = new MainDom(Mock.Of<ILogger>(), GetHostingEnvironment());
|
||||
/// <summary>
|
||||
|
||||
@@ -22,6 +22,7 @@ using Umbraco.Core.Services;
|
||||
using Umbraco.Core.Services.Implement;
|
||||
using Umbraco.Core.Strings;
|
||||
using Umbraco.Tests.TestHelpers.Stubs;
|
||||
using Current = Umbraco.Web.Composing.Current;
|
||||
|
||||
namespace Umbraco.Tests.TestHelpers
|
||||
{
|
||||
|
||||
@@ -22,7 +22,7 @@ using Umbraco.Web.PublishedCache;
|
||||
using Umbraco.Web.Security;
|
||||
using Umbraco.Web.Routing;
|
||||
using File = System.IO.File;
|
||||
using Umbraco.Core.Composing;
|
||||
using Umbraco.Web.Composing;
|
||||
using Umbraco.Core.Persistence.Mappers;
|
||||
using Umbraco.Core.Scoping;
|
||||
using Umbraco.Tests.Testing;
|
||||
@@ -55,6 +55,7 @@ namespace Umbraco.Tests.TestHelpers
|
||||
protected override ISqlSyntaxProvider SqlSyntax => GetSyntaxProvider();
|
||||
|
||||
protected ServiceContext ServiceContext => Current.Services;
|
||||
protected IVariationContextAccessor VariationContextAccessor => new TestVariationContextAccessor();
|
||||
|
||||
internal ScopeProvider ScopeProvider => Current.ScopeProvider as ScopeProvider;
|
||||
|
||||
|
||||
@@ -38,23 +38,22 @@ using Umbraco.Web.Actions;
|
||||
using Umbraco.Web.ContentApps;
|
||||
using Umbraco.Web.PublishedCache;
|
||||
using Umbraco.Web.Routing;
|
||||
using Umbraco.Web.Trees;
|
||||
using Umbraco.Core.Composing.CompositionExtensions;
|
||||
using Umbraco.Core.Hosting;
|
||||
using Umbraco.Core.Mapping;
|
||||
using Umbraco.Core.Serialization;
|
||||
using Umbraco.Web.Composing.CompositionExtensions;
|
||||
using Umbraco.Web.Composing;
|
||||
using Umbraco.Web.Hosting;
|
||||
using Umbraco.Web.Sections;
|
||||
using Current = Umbraco.Core.Composing.Current;
|
||||
using FileSystems = Umbraco.Core.IO.FileSystems;
|
||||
using Umbraco.Web.Templates;
|
||||
using Umbraco.Web.PropertyEditors;
|
||||
using Umbraco.Core.Dictionary;
|
||||
using Umbraco.Core.Persistence.Repositories;
|
||||
using Umbraco.Core.Security;
|
||||
using Umbraco.Core.Services;
|
||||
using Umbraco.Net;
|
||||
using Current = Umbraco.Web.Composing.Current;
|
||||
|
||||
namespace Umbraco.Tests.Testing
|
||||
{
|
||||
|
||||
@@ -14,7 +14,7 @@ using Newtonsoft.Json;
|
||||
using NUnit.Framework;
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Core.Cache;
|
||||
using Umbraco.Core.Composing;
|
||||
using Umbraco.Web.Composing;
|
||||
using Umbraco.Core.Configuration;
|
||||
using Umbraco.Core.Logging;
|
||||
using Umbraco.Core.Mapping;
|
||||
|
||||
@@ -12,7 +12,6 @@ using Newtonsoft.Json.Linq;
|
||||
using NUnit.Framework;
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Core.Cache;
|
||||
using Umbraco.Core.Composing;
|
||||
using Umbraco.Core.Configuration;
|
||||
using Umbraco.Core.Dictionary;
|
||||
using Umbraco.Core.Logging;
|
||||
@@ -22,7 +21,6 @@ using Umbraco.Core.Models.Membership;
|
||||
using Umbraco.Core.Persistence;
|
||||
using Umbraco.Core.PropertyEditors;
|
||||
using Umbraco.Core.Services;
|
||||
using Umbraco.Core.Strings;
|
||||
using Umbraco.Tests.TestHelpers;
|
||||
using Umbraco.Tests.TestHelpers.ControllerTesting;
|
||||
using Umbraco.Tests.TestHelpers.Entities;
|
||||
@@ -34,6 +32,7 @@ using Umbraco.Web.Models.ContentEditing;
|
||||
using Umbraco.Web.PropertyEditors;
|
||||
using Umbraco.Web.Trees;
|
||||
using Umbraco.Web.WebApi;
|
||||
using Umbraco.Web.Composing;
|
||||
using Task = System.Threading.Tasks.Task;
|
||||
|
||||
namespace Umbraco.Tests.Web.Controllers
|
||||
|
||||
@@ -14,7 +14,7 @@ namespace Umbraco.Tests.Web.Controllers
|
||||
public void Ensure_Same_Area1()
|
||||
{
|
||||
Assert.Throws<InvalidOperationException>(() =>
|
||||
new PluginControllerArea(TestObjects.GetGlobalSettings(),
|
||||
new PluginControllerArea(TestObjects.GetGlobalSettings(), IOHelper,
|
||||
new PluginControllerMetadata[]
|
||||
{
|
||||
PluginController.GetMetadata(typeof(Plugin1Controller)),
|
||||
@@ -27,7 +27,7 @@ namespace Umbraco.Tests.Web.Controllers
|
||||
public void Ensure_Same_Area3()
|
||||
{
|
||||
Assert.Throws<InvalidOperationException>(() =>
|
||||
new PluginControllerArea(TestObjects.GetGlobalSettings(),
|
||||
new PluginControllerArea(TestObjects.GetGlobalSettings(), IOHelper,
|
||||
new PluginControllerMetadata[]
|
||||
{
|
||||
PluginController.GetMetadata(typeof(Plugin1Controller)),
|
||||
@@ -39,7 +39,7 @@ namespace Umbraco.Tests.Web.Controllers
|
||||
[Test]
|
||||
public void Ensure_Same_Area2()
|
||||
{
|
||||
var area = new PluginControllerArea(TestObjects.GetGlobalSettings(),
|
||||
var area = new PluginControllerArea(TestObjects.GetGlobalSettings(), IOHelper,
|
||||
new PluginControllerMetadata[]
|
||||
{
|
||||
PluginController.GetMetadata(typeof(Plugin1Controller)),
|
||||
|
||||
@@ -12,7 +12,7 @@ using Newtonsoft.Json;
|
||||
using NUnit.Framework;
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Core.Cache;
|
||||
using Umbraco.Core.Composing;
|
||||
using Umbraco.Web.Composing;
|
||||
using Umbraco.Core.Configuration;
|
||||
using Umbraco.Core.IO;
|
||||
using Umbraco.Core.Logging;
|
||||
|
||||
@@ -33,7 +33,7 @@ namespace Umbraco.Tests.Web.Mvc
|
||||
public void SetUp()
|
||||
{
|
||||
Current.UmbracoContextAccessor = new TestUmbracoContextAccessor();
|
||||
Core.Composing.Current.Factory = Mock.Of<IFactory>();
|
||||
Current.Factory = Mock.Of<IFactory>();
|
||||
}
|
||||
|
||||
[TearDown]
|
||||
|
||||
@@ -7,7 +7,7 @@ using Moq;
|
||||
using NUnit.Framework;
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Core.Cache;
|
||||
using Umbraco.Core.Composing;
|
||||
using Umbraco.Web.Composing;
|
||||
using Umbraco.Core.Configuration.UmbracoSettings;
|
||||
using Umbraco.Core.Logging;
|
||||
using Umbraco.Core.Models.PublishedContent;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using NUnit.Framework;
|
||||
using Umbraco.Composing;
|
||||
using Umbraco.Web;
|
||||
using Umbraco.Web.Mvc;
|
||||
|
||||
|
||||
@@ -1,19 +1,15 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using Examine.LuceneEngine;
|
||||
using Lucene.Net.Analysis;
|
||||
using Lucene.Net.Analysis.Standard;
|
||||
using Moq;
|
||||
using NUnit.Framework;
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Core.Cache;
|
||||
using Umbraco.Core.Composing;
|
||||
using Umbraco.Core.Configuration;
|
||||
using Umbraco.Core.IO;
|
||||
using Umbraco.Core.Logging;
|
||||
using Umbraco.Tests.TestHelpers;
|
||||
using Umbraco.Web;
|
||||
using Current = Umbraco.Web.Composing.Current;
|
||||
|
||||
namespace Umbraco.Tests.Web
|
||||
{
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
@using Umbraco.Core.Models.PublishedContent
|
||||
@using Umbraco.Web
|
||||
@using Umbraco.Core
|
||||
@using Umbraco.Web.Composing
|
||||
@inherits Umbraco.Web.Macros.PartialViewMacroPage
|
||||
|
||||
@*
|
||||
@@ -33,7 +34,7 @@
|
||||
}
|
||||
|
||||
@* a folder with images under it *@
|
||||
foreach (var image in media.Children())
|
||||
foreach (var image in media.Children(Current.VariationContextAccessor))
|
||||
{
|
||||
@Render(image);
|
||||
}
|
||||
|
||||
@@ -1,17 +1,8 @@
|
||||
@using System.Collections
|
||||
@using System.Net.Http
|
||||
@using System.Web.Mvc.Html
|
||||
@using Umbraco.Core
|
||||
@using Umbraco.Core
|
||||
@using ClientDependency.Core
|
||||
@using ClientDependency.Core.Mvc
|
||||
@using Microsoft.Owin.Security
|
||||
@using Newtonsoft.Json
|
||||
@using Newtonsoft.Json.Linq
|
||||
@using Umbraco.Core.Composing
|
||||
@using Umbraco.Core.IO
|
||||
@using Umbraco.Web.Composing
|
||||
@using Umbraco.Web
|
||||
@using Umbraco.Web.Editors
|
||||
@using Umbraco.Core.Configuration
|
||||
@inherits System.Web.Mvc.WebViewPage<Umbraco.Web.Editors.BackOfficeModel>
|
||||
@{
|
||||
Layout = null;
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
@using Umbraco.Core
|
||||
@using ClientDependency.Core
|
||||
@using ClientDependency.Core.Mvc
|
||||
@using Umbraco.Core.Composing
|
||||
@using Umbraco.Core.IO
|
||||
@using Umbraco.Web.Composing
|
||||
@using Umbraco.Web
|
||||
@using Umbraco.Core.Configuration
|
||||
|
||||
@inherits WebViewPage<Umbraco.Web.Editors.BackOfficeModel>
|
||||
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
@using Umbraco.Core
|
||||
@using ClientDependency.Core
|
||||
@using ClientDependency.Core.Mvc
|
||||
@using Umbraco.Core.Composing
|
||||
@using Umbraco.Core.IO
|
||||
@using Umbraco.Web.Composing
|
||||
@using Umbraco.Web
|
||||
@using Umbraco.Core.Configuration
|
||||
|
||||
@inherits System.Web.Mvc.WebViewPage<Umbraco.Web.Editors.BackOfficePreviewModel>
|
||||
@{
|
||||
|
||||
@@ -3,22 +3,13 @@
|
||||
// This code was generated by a tool.
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace Umbraco.Web.UI.Config.Splashes {
|
||||
|
||||
|
||||
|
||||
|
||||
public partial class NoNodes {
|
||||
|
||||
/// <summary>
|
||||
/// Form1 control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.HtmlControls.HtmlForm Form1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<%@ Page Language="C#" AutoEventWireup="True" Inherits="Umbraco.Web.UI.Config.Splashes.NoNodes" CodeBehind="NoNodes.aspx.cs" %>
|
||||
<%@ Import Namespace="Umbraco.Core" %>
|
||||
<%@ Import Namespace="Umbraco.Core.Composing" %>
|
||||
<%@ Import Namespace="Umbraco.Web.Composing" %>
|
||||
<%@ Import Namespace="Umbraco.Core.Configuration" %>
|
||||
<%@ Import Namespace="Umbraco.Core.IO" %>
|
||||
|
||||
|
||||
@@ -30,8 +30,8 @@ namespace Umbraco.Web
|
||||
private readonly IUmbracoDatabaseFactory _databaseFactory;
|
||||
|
||||
public BatchedDatabaseServerMessenger(
|
||||
IRuntimeState runtime, IUmbracoDatabaseFactory databaseFactory, IScopeProvider scopeProvider, ISqlContext sqlContext, IProfilingLogger proflog, DatabaseServerMessengerOptions options, IHostingEnvironment hostingEnvironment)
|
||||
: base(runtime, scopeProvider, sqlContext, proflog, true, options, hostingEnvironment, Current.CacheRefreshers)
|
||||
IRuntimeState runtime, IUmbracoDatabaseFactory databaseFactory, IScopeProvider scopeProvider, ISqlContext sqlContext, IProfilingLogger proflog, DatabaseServerMessengerOptions options, IHostingEnvironment hostingEnvironment, CacheRefresherCollection cacheRefreshers)
|
||||
: base(runtime, scopeProvider, sqlContext, proflog, true, options, hostingEnvironment, cacheRefreshers)
|
||||
{
|
||||
_databaseFactory = databaseFactory;
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user