Move PublishingStrategyTests

This commit is contained in:
Nikolaj
2020-08-12 11:05:44 +02:00
parent 6b41b1dd8c
commit 4c9f18d260
2 changed files with 14 additions and 16 deletions

View File

@@ -6,22 +6,17 @@ using Umbraco.Core.Models;
using Umbraco.Tests.TestHelpers;
using Umbraco.Tests.TestHelpers.Entities;
using System.Linq;
using Microsoft.Extensions.DependencyInjection;
using Umbraco.Core.Services;
using Umbraco.Tests.Integration.Testing;
using Umbraco.Tests.Testing;
namespace Umbraco.Tests.Publishing
{
[TestFixture]
[UmbracoTest(Database = UmbracoTestOptions.Database.NewSchemaPerTest)]
public class PublishingStrategyTests : TestWithDatabaseBase
public class PublishingStrategyTests : UmbracoIntegrationTest
{
public override void SetUp()
{
base.SetUp();
//LegacyUmbracoSettings.SettingsFilePath = Current.IOHelper.MapPath(SystemDirectories.Config + Path.DirectorySeparatorChar, false);
}
private IContent _homePage;
[NUnit.Framework.Ignore("fixme - ignored test")]
@@ -33,31 +28,35 @@ namespace Umbraco.Tests.Publishing
public IEnumerable<IContent> CreateTestData()
{
var fileService = GetRequiredService<IFileService>();
var contentTypeService = GetRequiredService<IContentTypeService>();
var contentService = GetRequiredService<IContentService>();
//NOTE Maybe not the best way to create/save test data as we are using the services, which are being tested.
//Create and Save ContentType "umbTextpage" -> 1045
ContentType contentType = MockedContentTypes.CreateSimpleContentType("umbTextpage", "Textpage");
ServiceContext.FileService.SaveTemplate(contentType.DefaultTemplate); // else, FK violation on contentType!
ServiceContext.ContentTypeService.Save(contentType);
fileService.SaveTemplate(contentType.DefaultTemplate); // else, FK violation on contentType!
contentTypeService.Save(contentType);
var mandatoryType = MockedContentTypes.CreateSimpleContentType("umbMandatory", "Mandatory Doc Type", true);
//ServiceContext.FileService.SaveTemplate(mandatoryType.DefaultTemplate); // else, FK violation on contentType!
ServiceContext.ContentTypeService.Save(mandatoryType);
contentTypeService.Save(mandatoryType);
//Create and Save Content "Homepage" based on "umbTextpage" -> 1046
_homePage = MockedContent.CreateSimpleContent(contentType);
ServiceContext.ContentService.Save(_homePage, 0);
contentService.Save(_homePage, 0);
//Create and Save Content "Text Page 1" based on "umbTextpage" -> 1047
Content subpage = MockedContent.CreateSimpleContent(contentType, "Text Page 1", _homePage.Id);
ServiceContext.ContentService.Save(subpage, 0);
contentService.Save(subpage, 0);
//Create and Save Content "Text Page 2" based on "umbTextpage" -> 1048
Content subpage2 = MockedContent.CreateSimpleContent(contentType, "Text Page 2", _homePage.Id);
ServiceContext.ContentService.Save(subpage2, 0);
contentService.Save(subpage2, 0);
//Create and Save Content "Text Page 3" based on "umbTextpage" -> 1048
Content subpage3 = MockedContent.CreateSimpleContent(contentType, "Text Page 3", subpage2.Id);
ServiceContext.ContentService.Save(subpage3, 0);
contentService.Save(subpage3, 0);
return new[] {_homePage, subpage, subpage2, subpage3};
}

View File

@@ -380,7 +380,6 @@
<Compile Include="Persistence\Repositories\ScriptRepositoryTest.cs" />
<Compile Include="Persistence\Repositories\StylesheetRepositoryTest.cs" />
<Compile Include="PublishedContent\PublishedContentMoreTests.cs" />
<Compile Include="Publishing\PublishingStrategyTests.cs" />
<Compile Include="CoreThings\ObjectExtensionsTests.cs" />
<Compile Include="Cache\PublishedCache\PublishedContentCacheTests.cs" />
<Compile Include="Composing\LazyCollectionBuilderTests.cs" />