diff --git a/backend/src/Squidex.Infrastructure/Commands/DomainObject.cs b/backend/src/Squidex.Infrastructure/Commands/DomainObject.cs
index ccb6a7786..73fab1e1d 100644
--- a/backend/src/Squidex.Infrastructure/Commands/DomainObject.cs
+++ b/backend/src/Squidex.Infrastructure/Commands/DomainObject.cs
@@ -182,6 +182,8 @@ namespace Squidex.Infrastructure.Commands
if (persistence != null)
{
await persistence.DeleteAsync();
+
+ Setup(uniqueId);
}
snapshots.Clear();
diff --git a/backend/tools/TestSuite/TestSuite.ApiTests/ContentUpdateTests.cs b/backend/tools/TestSuite/TestSuite.ApiTests/ContentUpdateTests.cs
index 1a5bfc906..0e3885df0 100644
--- a/backend/tools/TestSuite/TestSuite.ApiTests/ContentUpdateTests.cs
+++ b/backend/tools/TestSuite/TestSuite.ApiTests/ContentUpdateTests.cs
@@ -505,15 +505,17 @@ namespace TestSuite.ApiTests
}
}
- [Fact]
- public async Task Should_delete_item()
+ [Theory]
+ [InlineData(true)]
+ [InlineData(false)]
+ public async Task Should_delete_item(bool permanent)
{
// STEP 1: Create a new item.
var content = await _.Contents.CreateAsync(new TestEntityData { Number = 2 }, true);
// STEP 2: Delete the item.
- await _.Contents.DeleteAsync(content.Id);
+ await _.Contents.DeleteAsync(content.Id, permanent);
// STEP 3: Retrieve all items and ensure that the deleted item does not exist.
@@ -521,5 +523,43 @@ namespace TestSuite.ApiTests
Assert.DoesNotContain(updated.Items, x => x.Id == content.Id);
}
+
+ [Theory]
+ [InlineData(true)]
+ [InlineData(false)]
+ public async Task Should_recreate_delete_item(bool permanent)
+ {
+ // STEP 1: Create a new item.
+ var content_1 = await _.Contents.CreateAsync(new TestEntityData { Number = 2 }, true);
+
+
+ // STEP 2: Delete the item.
+ await _.Contents.DeleteAsync(content_1.Id, permanent);
+
+
+ // STEP 3: Recreate the item with the same id.
+ var content_2 = await _.Contents.CreateAsync(new TestEntityData { Number = 2 }, content_1.Id, true);
+
+ Assert.Equal(Status.Published, content_2.Status);
+ }
+
+ [Theory]
+ [InlineData(true)]
+ [InlineData(false)]
+ public async Task Should_recreate_delete_item_with_upsert(bool permanent)
+ {
+ // STEP 1: Create a new item.
+ var content_1 = await _.Contents.CreateAsync(new TestEntityData { Number = 2 }, true);
+
+
+ // STEP 2: Delete the item.
+ await _.Contents.DeleteAsync(content_1.Id, permanent);
+
+
+ // STEP 3: Recreate the item with the same id.
+ var content_2 = await _.Contents.UpsertAsync(content_1.Id, new TestEntityData { Number = 2 }, true);
+
+ Assert.Equal(Status.Published, content_2.Status);
+ }
}
}
diff --git a/backend/tools/TestSuite/TestSuite.ApiTests/TestSuite.ApiTests.csproj b/backend/tools/TestSuite/TestSuite.ApiTests/TestSuite.ApiTests.csproj
index 87af19ffb..57f576e54 100644
--- a/backend/tools/TestSuite/TestSuite.ApiTests/TestSuite.ApiTests.csproj
+++ b/backend/tools/TestSuite/TestSuite.ApiTests/TestSuite.ApiTests.csproj
@@ -4,7 +4,7 @@
net5.0
-
+
diff --git a/backend/tools/TestSuite/TestSuite.LoadTests/TestSuite.LoadTests.csproj b/backend/tools/TestSuite/TestSuite.LoadTests/TestSuite.LoadTests.csproj
index de6914d01..d73647f34 100644
--- a/backend/tools/TestSuite/TestSuite.LoadTests/TestSuite.LoadTests.csproj
+++ b/backend/tools/TestSuite/TestSuite.LoadTests/TestSuite.LoadTests.csproj
@@ -4,7 +4,7 @@
net5.0
-
+
diff --git a/backend/tools/TestSuite/TestSuite.Shared/TestSuite.Shared.csproj b/backend/tools/TestSuite/TestSuite.Shared/TestSuite.Shared.csproj
index 51d13f59f..f6f5570d8 100644
--- a/backend/tools/TestSuite/TestSuite.Shared/TestSuite.Shared.csproj
+++ b/backend/tools/TestSuite/TestSuite.Shared/TestSuite.Shared.csproj
@@ -11,7 +11,7 @@
-
+