|
1 | | -// using NUnit.Framework; |
2 | | -// using Umbraco.Cms.Core; |
3 | | -// using Umbraco.Cms.Core.Models.ContentEditing; |
4 | | -// using Umbraco.Cms.Core.PublishedCache; |
5 | | -// using Umbraco.Cms.Core.Services; |
6 | | -// using Umbraco.Cms.Core.Services.OperationStatus; |
7 | | -// using Umbraco.Cms.Tests.Common.Testing; |
8 | | -// using Umbraco.Cms.Tests.Integration.Testing; |
9 | | -// FIXME |
10 | | -// namespace Umbraco.Cms.Tests.Integration.Umbraco.PublishedCache.HybridCache; |
11 | | -// |
12 | | -// [TestFixture] |
13 | | -// [UmbracoTest(Database = UmbracoTestOptions.Database.NewSchemaPerTest)] |
14 | | -// public class DocumentHybridCacheTemplateTests : UmbracoIntegrationTestWithContentEditing |
15 | | -// { |
16 | | -// protected override void CustomTestSetup(IUmbracoBuilder builder) => builder.AddUmbracoHybridCache(); |
17 | | -// |
18 | | -// private IPublishedContentCache PublishedContentHybridCache => GetRequiredService<IPublishedContentCache>(); |
19 | | -// |
20 | | -// private IContentEditingService ContentEditingService => GetRequiredService<IContentEditingService>(); |
21 | | -// |
22 | | -// [Test] |
23 | | -// public async Task Can_Get_Document_After_Removing_Template() |
24 | | -// { |
25 | | -// // Arrange |
26 | | -// var textPageBefore = await PublishedContentHybridCache.GetByIdAsync(TextpageId, true); |
27 | | -// Assert.AreEqual(textPageBefore.TemplateId, TemplateId); |
28 | | -// var updateModel = new ContentUpdateModel(); |
29 | | -// { |
30 | | -// updateModel.TemplateKey = null; |
31 | | -// updateModel.InvariantName = textPageBefore.Name; |
32 | | -// } |
33 | | -// |
34 | | -// // Act |
35 | | -// var updateContentResult = await ContentEditingService.UpdateAsync(textPageBefore.Key, updateModel, Constants.Security.SuperUserKey); |
36 | | -// |
37 | | -// // Assert |
38 | | -// Assert.AreEqual(updateContentResult.Status, ContentEditingOperationStatus.Success); |
39 | | -// var textPageAfter = await PublishedContentHybridCache.GetByIdAsync(TextpageId, true); |
40 | | -// // Should this not be null? |
41 | | -// Assert.AreEqual(textPageAfter.TemplateId, null); |
42 | | -// } |
43 | | -// } |
| 1 | +using NUnit.Framework; |
| 2 | +using Umbraco.Cms.Core; |
| 3 | +using Umbraco.Cms.Core.Models.ContentEditing; |
| 4 | +using Umbraco.Cms.Core.PublishedCache; |
| 5 | +using Umbraco.Cms.Core.Services; |
| 6 | +using Umbraco.Cms.Core.Services.OperationStatus; |
| 7 | +using Umbraco.Cms.Tests.Common.Testing; |
| 8 | +using Umbraco.Cms.Tests.Integration.Testing; |
| 9 | +namespace Umbraco.Cms.Tests.Integration.Umbraco.PublishedCache.HybridCache; |
| 10 | + |
| 11 | +[TestFixture] |
| 12 | +[UmbracoTest(Database = UmbracoTestOptions.Database.NewSchemaPerTest)] |
| 13 | +public class DocumentHybridCacheTemplateTests : UmbracoIntegrationTestWithContentEditing |
| 14 | +{ |
| 15 | + protected override void CustomTestSetup(IUmbracoBuilder builder) => builder.AddUmbracoHybridCache(); |
| 16 | + |
| 17 | + private IPublishedContentCache PublishedContentHybridCache => GetRequiredService<IPublishedContentCache>(); |
| 18 | + |
| 19 | + private IContentEditingService ContentEditingService => GetRequiredService<IContentEditingService>(); |
| 20 | + |
| 21 | + [Test] |
| 22 | + public async Task Can_Get_Document_After_Removing_Template() |
| 23 | + { |
| 24 | + // Arrange |
| 25 | + var textPageBefore = await PublishedContentHybridCache.GetByIdAsync(TextpageId, true); |
| 26 | + Assert.AreEqual(textPageBefore.TemplateId, TemplateId); |
| 27 | + var updateModel = new ContentUpdateModel(); |
| 28 | + { |
| 29 | + updateModel.TemplateKey = null; |
| 30 | + updateModel.InvariantName = textPageBefore.Name; |
| 31 | + } |
| 32 | + |
| 33 | + // Act |
| 34 | + var updateContentResult = await ContentEditingService.UpdateAsync(textPageBefore.Key, updateModel, Constants.Security.SuperUserKey); |
| 35 | + |
| 36 | + // Assert |
| 37 | + Assert.AreEqual(updateContentResult.Status, ContentEditingOperationStatus.Success); |
| 38 | + var textPageAfter = await PublishedContentHybridCache.GetByIdAsync(TextpageId, true); |
| 39 | + // Should this not be null? |
| 40 | + Assert.AreEqual(textPageAfter.TemplateId, null); |
| 41 | + } |
| 42 | +} |
0 commit comments