Files
Umbraco-CMS/tests/Umbraco.Tests.Integration/Umbraco.Infrastructure/Services/ContentBlueprintEditingServiceTests.Delete.cs
Elitsa Marinovska be16aa0663 V14: Test new content blueprint editing service (#15970)
* Fix wrong service name

* Move tests to correct place and fix naming

* Introducing a test base

* Tests IContentBlueprintEditingService

* Remove comment

* Adding Assert.Multiple

* More Assert.Multiple + Can_Create_With_Basic_Model() and Cannot_Create_When_Content_Type_Not_Found()
2024-04-04 09:40:06 +02:00

40 lines
1.2 KiB
C#

using NUnit.Framework;
using Umbraco.Cms.Core;
using Umbraco.Cms.Core.Services.OperationStatus;
namespace Umbraco.Cms.Tests.Integration.Umbraco.Infrastructure.Services;
public partial class ContentBlueprintEditingServiceTests
{
[TestCase(true)]
[TestCase(false)]
public async Task Can_Delete(bool variant)
{
var blueprint = await (variant ? CreateVariantContentBlueprint() : CreateInvariantContentBlueprint());
var result = await ContentBlueprintEditingService.DeleteAsync(blueprint.Key, Constants.Security.SuperUserKey);
Assert.Multiple(() =>
{
Assert.IsTrue(result.Success);
Assert.AreEqual(ContentEditingOperationStatus.Success, result.Status);
});
// re-get and verify deletion
blueprint = await ContentBlueprintEditingService.GetAsync(blueprint.Key);
Assert.IsNull(blueprint);
}
[Test]
public async Task Cannot_Delete_Non_Existing()
{
var result = await ContentBlueprintEditingService.DeleteAsync(Guid.NewGuid(), Constants.Security.SuperUserKey);
Assert.Multiple(() =>
{
Assert.IsFalse(result.Success);
Assert.AreEqual(ContentEditingOperationStatus.NotFound, result.Status);
});
}
}