Moved Models from Umbraco.Core to Umbraco.Infrastructure

This commit is contained in:
Bjarke Berg
2019-12-10 08:37:19 +01:00
parent becce7800b
commit 67536a49a7
43 changed files with 238 additions and 218 deletions

View File

@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Umbraco.Core.Models.PublishedContent;
using Umbraco.Core.Scoping;
using Umbraco.Web.PublishedCache.NuCache;
using Umbraco.Web.PublishedCache.NuCache.DataSource;
@@ -9,6 +10,9 @@ namespace Umbraco.Tests.Testing.Objects
{
internal class TestDataSource : IDataSource
{
private IPublishedModelFactory PublishedModelFactory { get; } = new NoopPublishedModelFactory();
public TestDataSource(params ContentNodeKit[] kits)
: this((IEnumerable<ContentNodeKit>) kits)
{ }
@@ -24,14 +28,14 @@ namespace Umbraco.Tests.Testing.Objects
// ContentNode is directly reused and modified by the snapshot service
public ContentNodeKit GetContentSource(IScope scope, int id)
=> Kits.TryGetValue(id, out var kit) ? kit.Clone() : default;
=> Kits.TryGetValue(id, out var kit) ? kit.Clone(PublishedModelFactory) : default;
public IEnumerable<ContentNodeKit> GetAllContentSources(IScope scope)
=> Kits.Values
.OrderBy(x => x.Node.Level)
.ThenBy(x => x.Node.ParentContentId)
.ThenBy(x => x.Node.SortOrder)
.Select(x => x.Clone());
.Select(x => x.Clone(PublishedModelFactory));
public IEnumerable<ContentNodeKit> GetBranchContentSources(IScope scope, int id)
=> Kits.Values
@@ -39,7 +43,7 @@ namespace Umbraco.Tests.Testing.Objects
.OrderBy(x => x.Node.Level)
.ThenBy(x => x.Node.ParentContentId)
.ThenBy(x => x.Node.SortOrder)
.Select(x => x.Clone());
.Select(x => x.Clone(PublishedModelFactory));
public IEnumerable<ContentNodeKit> GetTypeContentSources(IScope scope, IEnumerable<int> ids)
=> Kits.Values
@@ -47,7 +51,7 @@ namespace Umbraco.Tests.Testing.Objects
.OrderBy(x => x.Node.Level)
.ThenBy(x => x.Node.ParentContentId)
.ThenBy(x => x.Node.SortOrder)
.Select(x => x.Clone());
.Select(x => x.Clone(PublishedModelFactory));
public ContentNodeKit GetMediaSource(IScope scope, int id)
{