* Update gitignore * Move csproj * Update project references * Update solutions * Update build scripts * Tests used to share editorconfig with projects in src * Fix broken tests. * Stop copying around .editorconfig merged root one with linting * csharp_style_expression_bodied -> suggestion * Move StyleCop rulesets to matching directories and update shared build properties * Remove legacy build files, update NuGet.cofig and solution files * Restore myget source * Clean up .gitignore * Update .gitignore * Move new test classes to tests after merge * Gitignore + nuget config * Move new test Co-authored-by: Ronald Barendse <ronald@barend.se>
53 lines
2.3 KiB
C#
53 lines
2.3 KiB
C#
using System;
|
|
using System.Threading;
|
|
using NUnit.Framework;
|
|
using Umbraco.Cms.Core.Models;
|
|
using Umbraco.Tests.TestHelpers;
|
|
using Umbraco.Tests.TestHelpers.Entities;
|
|
|
|
namespace Umbraco.Tests.Services
|
|
{
|
|
[TestFixture]
|
|
public abstract class TestWithSomeContentBase : TestWithDatabaseBase
|
|
{
|
|
public override void SetUp()
|
|
{
|
|
base.SetUp();
|
|
CreateTestData();
|
|
}
|
|
|
|
public virtual void CreateTestData()
|
|
{
|
|
//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" -> 1060
|
|
ContentType contentType = MockedContentTypes.CreateSimpleContentType("umbTextpage", "Textpage");
|
|
contentType.Key = new Guid("1D3A8E6E-2EA9-4CC1-B229-1AEE19821522");
|
|
ServiceContext.FileService.SaveTemplate(contentType.DefaultTemplate); // else, FK violation on contentType!
|
|
ServiceContext.ContentTypeService.Save(contentType);
|
|
|
|
//Create and Save Content "Homepage" based on "umbTextpage" -> 1061
|
|
Content textpage = MockedContent.CreateSimpleContent(contentType);
|
|
textpage.Key = new Guid("B58B3AD4-62C2-4E27-B1BE-837BD7C533E0");
|
|
ServiceContext.ContentService.Save(textpage, 0);
|
|
|
|
//Create and Save Content "Text Page 1" based on "umbTextpage" -> 1062
|
|
Content subpage = MockedContent.CreateSimpleContent(contentType, "Text Page 1", textpage.Id);
|
|
subpage.ContentSchedule.Add(DateTime.Now.AddMinutes(-5), null);
|
|
ServiceContext.ContentService.Save(subpage, 0);
|
|
|
|
//Create and Save Content "Text Page 1" based on "umbTextpage" -> 1063
|
|
Content subpage2 = MockedContent.CreateSimpleContent(contentType, "Text Page 2", textpage.Id);
|
|
ServiceContext.ContentService.Save(subpage2, 0);
|
|
|
|
Content subpage3 = MockedContent.CreateSimpleContent(contentType, "Text Page 3", textpage.Id);
|
|
ServiceContext.ContentService.Save(subpage3, 0);
|
|
|
|
//Create and Save Content "Text Page Deleted" based on "umbTextpage" -> 1064
|
|
Content trashed = MockedContent.CreateSimpleContent(contentType, "Text Page Deleted", -20);
|
|
trashed.Trashed = true;
|
|
ServiceContext.ContentService.Save(trashed, 0);
|
|
}
|
|
}
|
|
}
|