Migrating tests that depend on Published Cache from the old test project (#11242)

* starts cleaning up old test project, removing ones we'll never convert, moves new test to where it should be.

* Makes ContentNodeKit immutable properties, moves first nucache tests over

* Gets the Nucache unit tests working and refactors a bit to use builder pattern for models.

* Migrates first xml based cache test to use nucache.

* Migrates a bunch more

* Migrates remaining tests for PublishedContentTests

* Moves PublishedRouterTests

* Moves PublishedContentExtensionTests

* Moves more tests.

* committing wip

* committing wip

* Gets PublishedContentLanguageVariantTests converted and working.

* Fixes DataTable ext method and moves PublishedContentDataTableTests

* Moves PublishedMediaTests

* wip - moving EntityXmlSerializerTests

* Moves more tests

* moves more tests

* moves more tests

* Move another test

* Moves more tests

* Fix test

* move another test

* Moves more tests

* Moves more tests

* Moves more tests

* wip before merge

* More tests

* More tests

* More tests

* More tests

* More tests

* More tests

* Cleanup and moving classes.

* Remove unused code

* Fixed failing tests, due to new null checks, that did not exist in v8

* Avoid breaking changes

* Unbreak more things, even that it the old solution was crazy..

* Fixed bug where ordering of stream readings was changed..

* cleanup

Co-authored-by: Bjarke Berg <mail@bergmania.dk>
This commit is contained in:
Shannon Deminick
2021-10-19 23:11:54 +11:00
committed by GitHub
parent 49e1aec71c
commit c77dc5dc00
171 changed files with 5400 additions and 17944 deletions

View File

@@ -1,23 +1,39 @@
using Umbraco.Cms.Core.Models.PublishedContent;
using System;
using Umbraco.Cms.Core.Models.PublishedContent;
using Umbraco.Cms.Core.PublishedCache;
using Umbraco.Cms.Infrastructure.PublishedCache.DataSource;
namespace Umbraco.Cms.Infrastructure.PublishedCache
{
// what's needed to actually build a content node
public struct ContentNodeKit
{
[Obsolete("This will be changed to a property in future versions")]
public ContentNode Node;
[Obsolete("This will be changed to a property in future versions")]
public int ContentTypeId;
[Obsolete("This will be changed to a property in future versions")]
public ContentData DraftData;
[Obsolete("This will be changed to a property in future versions")]
public ContentData PublishedData;
public ContentNodeKit(ContentNode node, int contentTypeId, ContentData draftData, ContentData publishedData)
{
Node = node;
ContentTypeId = contentTypeId;
DraftData = draftData;
PublishedData = publishedData;
}
public bool IsEmpty => Node == null;
public bool IsNull => ContentTypeId < 0;
public static ContentNodeKit Empty { get; } = new ContentNodeKit();
public static ContentNodeKit Null { get; } = new ContentNodeKit { ContentTypeId = -1 };
public static ContentNodeKit Null { get; } = new ContentNodeKit(null, -1, null, null);
public void Build(
IPublishedContentType contentType,
@@ -41,12 +57,9 @@ namespace Umbraco.Cms.Infrastructure.PublishedCache
}
public ContentNodeKit Clone(IPublishedModelFactory publishedModelFactory)
=> new ContentNodeKit
{
ContentTypeId = ContentTypeId,
DraftData = DraftData,
PublishedData = PublishedData,
Node = new ContentNode(Node, publishedModelFactory)
};
=> new ContentNodeKit(new ContentNode(Node, publishedModelFactory), ContentTypeId, DraftData, PublishedData);
public ContentNodeKit Clone(IPublishedModelFactory publishedModelFactory, ContentData draftData, ContentData publishedData)
=> new ContentNodeKit(new ContentNode(Node, publishedModelFactory), ContentTypeId, draftData, publishedData);
}
}