Files
Umbraco-CMS/tests/Umbraco.Tests.Integration/Umbraco.Core/Services/DocumentNavigationServiceTestsBase.cs
Kenn Jacobsen 2cf28271cd Service refactoring to "fully" enable segments (#19114)
* Refactor serverside content editing to support all variance combinations

* Fix build errors

* Reintroduce the tests ignored by #19060

---------

Co-authored-by: Mads Rasmussen <madsr@hey.com>
2025-04-23 14:54:51 +02:00

62 lines
2.2 KiB
C#

using NUnit.Framework;
using Umbraco.Cms.Core;
using Umbraco.Cms.Core.Cache;
using Umbraco.Cms.Core.Models;
using Umbraco.Cms.Core.Models.ContentEditing;
using Umbraco.Cms.Core.Notifications;
using Umbraco.Cms.Core.Services;
using Umbraco.Cms.Core.Services.Navigation;
using Umbraco.Cms.Core.Sync;
using Umbraco.Cms.Tests.Common.Testing;
using Umbraco.Cms.Tests.Integration.Testing;
using Umbraco.Cms.Tests.Integration.Umbraco.Infrastructure.Scoping;
namespace Umbraco.Cms.Tests.Integration.Umbraco.Core.Services;
[TestFixture]
[UmbracoTest(Database = UmbracoTestOptions.Database.NewSchemaPerTest)]
internal abstract class DocumentNavigationServiceTestsBase : UmbracoIntegrationTest
{
protected IContentTypeService ContentTypeService => GetRequiredService<IContentTypeService>();
// Testing with IContentEditingService as it calls IContentService underneath
protected IContentEditingService ContentEditingService => GetRequiredService<IContentEditingService>();
protected IDocumentNavigationQueryService DocumentNavigationQueryService => GetRequiredService<IDocumentNavigationQueryService>();
protected IContentType ContentType { get; set; }
protected IContent Root { get; set; }
protected IContent Child1 { get; set; }
protected IContent Grandchild1 { get; set; }
protected IContent Grandchild2 { get; set; }
protected IContent Child2 { get; set; }
protected IContent Grandchild3 { get; set; }
protected IContent GreatGrandchild1 { get; set; }
protected IContent Child3 { get; set; }
protected IContent Grandchild4 { get; set; }
protected ContentCreateModel CreateContentCreateModel(string name, Guid key, Guid? contentTypeKey = null, Guid? parentKey = null)
=> new()
{
ContentTypeKey = contentTypeKey ?? ContentType.Key,
ParentKey = parentKey ?? Constants.System.RootKey,
Variants = [new () { Name = name }],
Key = key,
};
protected override void CustomTestSetup(IUmbracoBuilder builder)
{
builder.Services.AddUnique<IServerMessenger, ScopedRepositoryTests.LocalServerMessenger>();
builder.AddNotificationHandler<ContentTreeChangeNotification, ContentTreeChangeDistributedCacheNotificationHandler>();
}
}